diff options
author | Kat Marchán <kzm@zkat.tech> | 2018-08-15 23:13:14 +0300 |
---|---|---|
committer | Kat Marchán <kzm@zkat.tech> | 2018-08-21 02:17:05 +0300 |
commit | 85f4d79059865d5267f3516b6cdbc746012202c6 (patch) | |
tree | 2c69d83584d35ce60f138d3c010d4665c01cceb5 /node_modules/cacache | |
parent | 4c57316d5633e940105fa545b52d8fbfd2eb9f75 (diff) |
cacache@11.2.0
This rounds out sync read support a bit more. Nothing npm-relevant.
Credit: @zkat
Diffstat (limited to 'node_modules/cacache')
-rw-r--r-- | node_modules/cacache/CHANGELOG.md | 10 | ||||
-rw-r--r-- | node_modules/cacache/lib/content/read.js | 31 | ||||
-rw-r--r-- | node_modules/cacache/package.json | 22 |
3 files changed, 51 insertions, 12 deletions
diff --git a/node_modules/cacache/CHANGELOG.md b/node_modules/cacache/CHANGELOG.md index a9aeb3bc1..ec9174f80 100644 --- a/node_modules/cacache/CHANGELOG.md +++ b/node_modules/cacache/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +<a name="11.2.0"></a> +# [11.2.0](https://github.com/zkat/cacache/compare/v11.1.0...v11.2.0) (2018-08-08) + + +### Features + +* **read:** add sync support to other internal read.js fns ([fe638b6](https://github.com/zkat/cacache/commit/fe638b6)) + + + <a name="11.1.0"></a> # [11.1.0](https://github.com/zkat/cacache/compare/v11.0.3...v11.1.0) (2018-08-01) diff --git a/node_modules/cacache/lib/content/read.js b/node_modules/cacache/lib/content/read.js index e308ead92..8f1acc06d 100644 --- a/node_modules/cacache/lib/content/read.js +++ b/node_modules/cacache/lib/content/read.js @@ -73,8 +73,10 @@ function readStream (cache, integrity, opts) { let copyFileAsync if (fs.copyFile) { module.exports.copy = copy + module.exports.copy.sync = copySync copyFileAsync = BB.promisify(fs.copyFile) } + function copy (cache, integrity, dest, opts) { opts = ReadOpts(opts) return withContentSri(cache, integrity, (cpath, sri) => { @@ -82,11 +84,18 @@ function copy (cache, integrity, dest, opts) { }) } +function copySync (cache, integrity, dest, opts) { + opts = ReadOpts(opts) + return withContentSriSync(cache, integrity, (cpath, sri) => { + return fs.copyFileSync(cpath, dest) + }) +} + module.exports.hasContent = hasContent function hasContent (cache, integrity) { if (!integrity) { return BB.resolve(false) } return withContentSri(cache, integrity, (cpath, sri) => { - return lstatAsync(cpath).then(stat => ({size: stat.size, sri})) + return lstatAsync(cpath).then(stat => ({size: stat.size, sri, stat})) }).catch(err => { if (err.code === 'ENOENT') { return false } if (err.code === 'EPERM') { @@ -99,6 +108,26 @@ function hasContent (cache, integrity) { }) } +module.exports.hasContent.sync = hasContentSync +function hasContentSync (cache, integrity) { + if (!integrity) { return false } + return withContentSriSync(cache, integrity, (cpath, sri) => { + try { + const stat = fs.lstatSync(cpath) + return {size: stat.size, sri, stat} + } catch (err) { + if (err.code === 'ENOENT') { return false } + if (err.code === 'EPERM') { + if (process.platform !== 'win32') { + throw err + } else { + return false + } + } + } + }) +} + function withContentSri (cache, integrity, fn) { return BB.try(() => { const sri = ssri.parse(integrity) diff --git a/node_modules/cacache/package.json b/node_modules/cacache/package.json index 01e20c134..bf13242f8 100644 --- a/node_modules/cacache/package.json +++ b/node_modules/cacache/package.json @@ -1,19 +1,19 @@ { - "_from": "cacache@latest", - "_id": "cacache@11.1.0", + "_from": "cacache@11.2.0", + "_id": "cacache@11.2.0", "_inBundle": false, - "_integrity": "sha512-wFLexxfPdlvoUlpHIaU4y4Vm+Im/otOPCg1ov5g9/HRfUhVA8GpDdQL66SWBgRpgNC+5ebMT1Vr1RyPaFrJVqw==", + "_integrity": "sha512-IFWl6lfK6wSeYCHUXh+N1lY72UDrpyrYQJNIVQf48paDuWbv5RbAtJYf/4gUQFObTCHZwdZ5sI8Iw7nqwP6nlQ==", "_location": "/cacache", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "cacache@latest", + "raw": "cacache@11.2.0", "name": "cacache", "escapedName": "cacache", - "rawSpec": "latest", + "rawSpec": "11.2.0", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "11.2.0" }, "_requiredBy": [ "#USER", @@ -21,9 +21,9 @@ "/make-fetch-happen", "/pacote" ], - "_resolved": "https://registry.npmjs.org/cacache/-/cacache-11.1.0.tgz", - "_shasum": "3d76dbc2e9da413acaad2557051960a4dad3e1a4", - "_spec": "cacache@latest", + "_resolved": "https://registry.npmjs.org/cacache/-/cacache-11.2.0.tgz", + "_shasum": "617bdc0b02844af56310e411c0878941d5739965", + "_spec": "cacache@11.2.0", "_where": "/Users/zkat/Documents/code/work/npm", "author": { "name": "Kat Marchán", @@ -124,5 +124,5 @@ "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'" }, - "version": "11.1.0" + "version": "11.2.0" } |