Socket
Socket
Sign inDemoInstall

cacache

Package Overview
Dependencies
56
Maintainers
3
Versions
100
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 11.1.0 to 11.2.0

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<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>

@@ -7,0 +17,0 @@ # [11.1.0](https://github.com/zkat/cacache/compare/v11.0.3...v11.1.0) (2018-08-01)

31

lib/content/read.js

@@ -76,4 +76,6 @@ 'use strict'

module.exports.copy = copy
module.exports.copy.sync = copySync
copyFileAsync = BB.promisify(fs.copyFile)
}
function copy (cache, integrity, dest, opts) {

@@ -86,2 +88,9 @@ opts = ReadOpts(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

@@ -91,3 +100,3 @@ function hasContent (cache, integrity) {

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 => {

@@ -105,2 +114,22 @@ if (err.code === 'ENOENT') { return false }

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) {

@@ -107,0 +136,0 @@ return BB.try(() => {

2

package.json
{
"name": "cacache",
"version": "11.1.0",
"version": "11.2.0",
"cache-version": {

@@ -5,0 +5,0 @@ "content": "2",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc