How to use the ensureFile function from fs-promise
Find comprehensive JavaScript fs-promise.ensureFile code examples handpicked from public code repositorys.
GitHub: brencon/organize-photos
108 109 110 111 112 113 114 115 116 117
.then(sortResp) // Write last read file of each type to a metadata file in the dest .then((resp) => { resp[constants.METADATA] = lastReadFiles(resp) const p = options.real && device ? fs.ensureFile(device).then(() => fs.writeJson(device, resp[constants.METADATA], {spaces: 0})) : Promise.resolve() return p.then(() => resp) }) // Always close the exiftool stream
1
1
0
+ 3 other calls in file
36 37 38 39 40 41 42 43 44 45
function save(stream, videoItem) { return Promise.resolve() .then(() => validateVideo(videoItem)) .then(() => getFilePath(videoItem)) .then(filePath => { return fs.ensureFile(filePath) .then(() => filePath); }) .then(fs.createWriteStream) .then(writeStream => pipeStream(stream, writeStream))
0
0
0
fs-promise.writeJson is the most popular function in fs-promise (6458 examples)