natron-vinyl
Natron Vinyl Utilities
Vinyl FS
This module exports
src
,dest
,symlink
fromvinyl-fs
.
Merge Streams
import {task} from "natron";
import {src, dest, merge} from "natron-vinyl";
function bundle() {
let s = src("src/**/*.js");
let v = src("vnd/**/*.js");
return (merge([s, v], {preserveOrder: true})
.pipe(dest("dist"))
);
}
task(bundle).run();
Waiting for Multiple Streams to Finish
import {task} from "natron";
import {src, dest, awaitAll} from "natron-vinyl";
function copy() {
let j = src("src/**/*.js").pipe(dest("js"));
let h = src("src/**/*.html").pipe(dest("html"));
return awaitAll([j, h]);
}
task(copy).run();
Stream from Promise
import {task} from "natron";
import {src, dest, File, fromPromise} from "natron-vinyl";
function dlFile(name, url) {
return (fetch(url)
.then((res) => res.text())
.then((txt) => {
let contents = new Buffer(txt);
return new File({path: name, contents});
})
);
}
function copy() {
let url = "http://example.com/test.txt";
return (fromPromise(dlFile("test.txt", url))
.pipe(dest("dist"))
);
}
task(copy).run();
Updated less than a minute ago