Comparing version 2.0.0 to 2.1.0
@@ -8,2 +8,10 @@ 'use strict'; | ||
function booleanOrFunc(v, file) { | ||
if (typeof v !== 'boolean' && typeof v !== 'function') { | ||
return null; | ||
} | ||
return typeof v === 'boolean' ? v : v(file); | ||
} | ||
function stringOrFunc(v, file) { | ||
@@ -24,3 +32,4 @@ if (typeof v !== 'string' && typeof v !== 'function') { | ||
}, opt); | ||
options.flag = (options.overwrite ? 'w' : 'wx'); | ||
var overwrite = booleanOrFunc(options.overwrite, file); | ||
options.flag = (overwrite ? 'w' : 'wx'); | ||
@@ -27,0 +36,0 @@ var cwd = path.resolve(options.cwd); |
@@ -11,3 +11,9 @@ 'use strict'; | ||
} | ||
file.contents = stripBom(data); | ||
if (opt.stripBOM){ | ||
file.contents = stripBom(data); | ||
} else { | ||
file.contents = data; | ||
} | ||
cb(null, file); | ||
@@ -14,0 +20,0 @@ }); |
@@ -7,4 +7,8 @@ 'use strict'; | ||
function streamFile(file, opt, cb) { | ||
file.contents = fs.createReadStream(file.path) | ||
.pipe(stripBom()); | ||
file.contents = fs.createReadStream(file.path); | ||
if (opt.stripBOM) { | ||
file.contents = file.contents.pipe(stripBom()); | ||
} | ||
cb(null, file); | ||
@@ -11,0 +15,0 @@ } |
@@ -24,2 +24,3 @@ 'use strict'; | ||
buffer: true, | ||
stripBOM: true, | ||
sourcemaps: false, | ||
@@ -26,0 +27,0 @@ passthrough: false, |
{ | ||
"name": "vinyl-fs", | ||
"description": "Vinyl adapter for the file system", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"homepage": "http://github.com/wearefractal/vinyl-fs", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/wearefractal/vinyl-fs.git", |
# vinyl-fs [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status][depstat-image]][depstat-url] | ||
## Information | ||
<table> | ||
<tr> | ||
<td>Package</td><td>vinyl-fs</td> | ||
</tr> | ||
<tr> | ||
<td>Description</td> | ||
<td>Vinyl adapter for the file system</td> | ||
</tr> | ||
<tr> | ||
<td>Node Version</td> | ||
<td>>= 0.10</td> | ||
</tr> | ||
</table> | ||
<table><br><tr><br><td>Package</td><td>vinyl-fs</td><br></tr><br><tr><br><td>Description</td><br><td>Vinyl adapter for the file system</td><br></tr><br><tr><br><td>Node Version</td><br><td>>= 0.10</td><br></tr><br></table> | ||
@@ -65,2 +53,6 @@ ## Usage | ||
- since - `Date` or `number` if you only want files that have been modified since the time specified. | ||
- stripBOM - `true` or `false` if you want the BOM to be stripped on UTF-8 encoded files. | ||
- Default value is `true`. | ||
- passthrough - `true` or `false` if you want a duplex stream which passes items through and emits globbed files. | ||
@@ -71,2 +63,4 @@ - Default is `false`. | ||
- Default is `false`. | ||
- Will load inline sourcemaps and resolve sourcemap links from files | ||
- Uses `gulp-sourcemaps` under the hood | ||
@@ -104,3 +98,9 @@ - followSymlinks - `true` if you want to recursively resolve symlinks to their targets; set to `false` to preserve them as symlinks. | ||
- Default is `true`, to always overwrite existing files. | ||
- Can also be a function that takes in a file and returns `true` or `false`. | ||
- sourcemaps - | ||
- Default is `null` aka do not write sourcemaps. | ||
- Use `.` to write sourcemaps as files | ||
- Uses `gulp-sourcemaps` under the hood | ||
- Returns a Readable/Writable stream. | ||
@@ -107,0 +107,0 @@ - On write the stream will save the [vinyl] File to disk at the folder/cwd specified. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20044
390