diff options
Diffstat (limited to 'deps/npm/node_modules/cacache/lib/content/read.js')
-rw-r--r-- | deps/npm/node_modules/cacache/lib/content/read.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/deps/npm/node_modules/cacache/lib/content/read.js b/deps/npm/node_modules/cacache/lib/content/read.js index 14ca7d905d..b09ad5cb40 100644 --- a/deps/npm/node_modules/cacache/lib/content/read.js +++ b/deps/npm/node_modules/cacache/lib/content/read.js @@ -52,6 +52,18 @@ function readStream (cache, integrity, opts) { return stream } +if (fs.copyFile) { + module.exports.copy = copy +} +function copy (cache, integrity, dest, opts) { + opts = opts || {} + return pickContentSri(cache, integrity).then(content => { + const sri = content.sri + const cpath = contentPath(cache, sri) + return fs.copyFileAsync(cpath, dest).then(() => content.size) + }) +} + module.exports.hasContent = hasContent function hasContent (cache, integrity) { if (!integrity) { return BB.resolve(false) } |