UNPKG

522 BJavaScriptView Raw
1const src = require('vinyl-fs/lib/src');
2const symlink = require('vinyl-fs/lib/symlink');
3const through2 = require('through2');
4const { basename, resolve } = require('path');
5
6function dest(target, { cwd = process.cwd() } = {}) {
7 return through2.obj(function through2Obj(file, encoding, cb) {
8 try {
9 file.path = resolve(cwd, target, basename(file.path));
10 this.push(file);
11 } catch (err) {
12 this.emit('error', new Error(err));
13 }
14 cb();
15 });
16}
17module.exports = {
18 src,
19 dest,
20 symlink
21};