Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Set the `stat` property on a file object. Abstraction from vinyl-fs to support stream or non-stream usage.
Set the
stat
property on a file object. Abstraction from vinyl-fs to support stream or non-stream usage.
This is inspired by the file.stat
code in vinyl-fs. I needed a function that essentially did the same thing but could be used with stream or non-stream code.
Install with npm
$ npm i file-stat --save
var through = require('through2');
var stats = require('file-stat');
function toStream(fp) {
var stream = through.obj();
stream.write({path: fp});
stream.end();
return stream;
}
toStream('README.md')
.pipe(stats())
.on('data', function (file) {
// adds `stat` object to file
console.log(file.stat);
})
.on('end', function () {
console.log('Done.');
});
async
A .getStats()
method is exposed for non-stream usage.
stats.getStats({path: 'README.md'}, function (err, res) {
// (typeof res.stat === 'object') => true
});
contents
property on a file object. Abstraction from vinyl-fs to support stream or… more | homepagestat
property on a file object. | homepageInstall dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on October 05, 2015.
FAQs
Set the `stat` property on a file object. Abstraction from vinyl-fs to support stream or non-stream usage.
The npm package file-stat receives a total of 60,025 weekly downloads. As such, file-stat popularity was classified as popular.
We found that file-stat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.