Initial commit

This commit is contained in:
Developer
2025-04-21 16:03:20 +02:00
commit 2832896157
22874 changed files with 3092801 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
'use strict';
var fileType = require('file-type');
var PassThrough = require('readable-stream/passthrough');
var uuid = require('uuid');
var Vinyl = require('vinyl');
module.exports.file = function (buf, name) {
var ext = fileType(buf) ? '.' + fileType(buf).ext : null;
return new Vinyl({
contents: buf,
path: (name || uuid.v4()) + (ext || '')
});
};
module.exports.stream = function (buf, name) {
var stream = new PassThrough({objectMode: true});
stream.end(module.exports.file(buf, name));
return stream;
};