blob: 51791b4c31f12380bc4171bdaa37338224c5ce20 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
const ncp = require("ncp");
const path = require("path");
const mkdirp = require("mkdirp");
function saveStaticFile(filePath) {
return new Promise((resolve, reject) => {
const relativePath = path.relative("public", filePath);
const destination = path.join("output", relativePath);
mkdirp(path.dirname(destination), err => {
if (err) { return reject(err); }
ncp(filePath, destination, err => {
if (err) { return reject(err); }
resolve("ok");
});
});
});
}
module.exports = saveStaticFile;
|