Package Exports
- fs-utils
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fs-utils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
fs-utils 
fs extras and utilities to extend the node.js file system module. Used in Assemble and many other projects.
Install
Install with npm:
npm i fs-utils --save-devRun tests
npm testUsage
var fs = require('fs-utils');API
.stripcr
str{String}returns: {String}
Strip carriage returns from a string.
.stripBOM
Strip byte order marks from a string.
str{String}returns: {String}
See BOM
.forwardSlash
str{String}returns: {String}
Normalize all slashes to forward slashes.
.isEmpty
filepath{String}returns: {Boolean}
Return true if the file exists and is empty.
.isDir
filepath{String}returns: {Boolean}
Return true if the filepath is a directory.
.isLink
filepath{String}returns: {Boolean}
True if the filepath is a symbolic link.
.glob
patterns{String|Array}returns: {options}
Glob files using globby. Or glob files synchronously
with glob.sync.
.readFileSync
filepath{String}returns: {String}
Read a file synchronously. Also strips any byte order marks.
readFile
filepath{String}options{Object}normalize{Boolean}: Strip carriage returns and BOM.encoding{String}: Default isutf8callback{Function}
Read a file asynchronously.
.readJSONSync
filepath{String}returns: {Object}
Read a file synchronously and parse contents as JSON. marks.
.readJSON
filepath{String}callback{Function}returns: {Object}
Read JSON file asynchronously and parse content as JSON
.readYAMLSync
filepath{String}returns: {Object}
Read a YAML file synchronously and parse its content as JSON
.readYAML
filepath{String}returns: {Object}
Read a YAML file synchronously and parse its content as JSON
.readDataSync
filepath{String}options{String}returns: {String}
Read JSON or YAML. Determins the reader automatically based on file extension.
.readData
filepath{String}options{String}returns: {String}
Read JSON or YAML async. Determins the reader automatically based on file extension.
.writeFile
Write
.writeFileSync
dest{String}str{String}options{Options}
Synchronously write files to disk, creating any intermediary directories if they don't exist.
.writeJSONSync
dest{String}str{String}options{Options}
Synchronously write JSON to disk, creating any intermediary directories if they don't exist.
.writeJSON
dest{String}str{String}options{Options}
Asynchronously write files to disk, creating any intermediary directories if they don't exist.
.writeYAMLSync
dest{String}str{String}options{Options}
Synchronously write YAML to disk, creating any intermediary directories if they don't exist.
.writeYAML
dest{String}str{String}options{Options}
Aynchronously write YAML to disk, creating any intermediary directories if they don't exist.
.writeDataSync
Synchronously write JSON or YAML to disk, creating any intermediary directories if they don't exist. Data type is determined by the dest file extension.
dest{String}str{String}options{Options}
writeDataSync('foo.yml', {foo: "bar"});.writeData
Asynchronously write JSON or YAML to disk, creating any intermediary directories if they don't exist. Data type is determined by the dest file extension.
dest{String}str{String}options{Options}
writeDataSync('foo.yml', {foo: "bar"});.copyFileSync
src{String}dest{String}
Copy files synchronously;
.rmdir
dir{String}- {Function}: `cb
returns: {Function}
Asynchronously remove dirs and child dirs that exist.
.ext
filepath{String}returns: {String}
Return the file extension.
.dirname
filepath{String}returns: {String}
Directory path excluding filename.
.last
filepath{String}returns: {String}
The last n segments of a filepath. If a number
isn't passed for n, the last segment is returned.
.first
filepath{String}returns: {String}
The first n segments of a filepath. If a number
isn't passed for n, the first segment is returned.
.lastChar
Returns the last character in filepath
filepath{String}returns: {String}
lastChar('foo/bar/baz/');
//=> '/'.addSlash
Add a trailing slash to the filepath.
filepath{String}returns: {String}
Note, this does not consult the file system to check if the filepath is file or a directory.
.normalizePath
filepath{String}returns: {String}
Normalize a filepath and remove trailing slashes.
.relative
filepath{String}returns: {String}
Resolve the relative path from a to `b.
.isAbsolute
- {[type]}: filepath
returns: {Boolean}
Return true if the path is absolute.
.equivalent
filepath{String}a{String}b{String}returns: {Boolean}
Return true if path a is the same as path `b.
.doesPathContain
True if descendant path(s) contained within ancestor path. Note: does not test if paths actually exist.
ancestor{String}: The starting path.returns: {Boolean}
Sourced from [Grunt].
.isPathCwd
True if a filepath is the CWD.
filepath{String}returns: {Boolean}
Sourced from [Grunt].
.isPathInCwd
filepath{String}returns: {Boolean}
True if a filepath is contained within the CWD.
Author
Jon Schlinkert
License
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on October 06, 2014.