package
Read a directory of files
npm install read-directoryGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Read a directory of files.
npm install --save read-directoryvar read = require('read-directory')
read('./files', function (err, contents) {
console.log(contents)
})var read = require('read-directory')
var contents = read.sync('./files')Use the included browserify transform module to convert calls to read.sync to the contents of the directory.
Note that to use the browserify transform you must use read.sync, and the path to the file directory can not be a variable.
var path = require('path')
var read = require('read-directory')
var contents = read.sync(path.join(__dirname, 'files'))browserify index.js -t read-directory -o bundle.jsbudo index.js:bundle.js -- -t read-directoryRead the contents of a directory asynchronously
Parameters
Examples
var read = require('read-directory')
read('./files', function (err, contents) {
console.log(contents)
})Read the contents of a directory asynchronously
Parameters
Examples
var read = require('read-directory')
var contents = read.sync('./files')yoshuawuyts
i@yoshuawuyts.com
options.encoding String – encoding of files, default: utf8options.filter String – glob pattern for filtering files, examples: *.md, *.cssoptions.ignore String – glob pattern for ignoring filesoptions.ignore Array – array of glob patterns for ignoring filesoptions.transform Function – A function you can use to transform the contents of files after they are readoptions.encoding String – encoding of files, default: utf8options.filter String – glob pattern for filtering files, examples: *.md, *.cssoptions.ignore String – glob pattern for ignoring filesoptions.ignore Array – array of glob patterns for ignoring filesoptions.transform Function – A function you can use to transform the contents of files after they are readEstimated unpacked size across 51 packages.
9.4 MB
Includes dependencies.
5 direct · 4 outdated
^7.1.2
14.0.6
^1.0.3
3.0.0
^2.0.3
5.0.12
^1.1.1
2.0.0
^3.0.0
3.0.4