Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@parcel/cache

Package Overview
Dependencies
Maintainers
1
Versions
897
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@parcel/cache - npm Package Compare versions

Comparing version 2.0.0-canary.1632 to 2.0.0-canary.1633

6

lib/LMDBCache.js

@@ -154,2 +154,8 @@ "use strict";

async setLargeBlob(key, contents, options) {
const previousEntry = await this.get(key);
if (previousEntry) {
await this.store.remove(key);
await this.fsCache.deleteLargeBlob(previousEntry.largeBlobKey);
}
// $FlowFixMe flow libs are outdated but we only support node>16 so randomUUID is present

@@ -156,0 +162,0 @@ const largeBlobKey = `${key}_${_crypto().default.randomUUID()}`;

12

package.json
{
"name": "@parcel/cache",
"description": "Interface for defining caches and file-system, IDB and LMDB implementations.",
"version": "2.0.0-canary.1632+98a6b8ed7",
"version": "2.0.0-canary.1633+5b0f645b9",
"license": "MIT",

@@ -28,9 +28,9 @@ "publishConfig": {

"dependencies": {
"@parcel/fs": "2.0.0-canary.1632+98a6b8ed7",
"@parcel/logger": "2.0.0-canary.1632+98a6b8ed7",
"@parcel/utils": "2.0.0-canary.1632+98a6b8ed7",
"@parcel/fs": "2.0.0-canary.1633+5b0f645b9",
"@parcel/logger": "2.0.0-canary.1633+5b0f645b9",
"@parcel/utils": "2.0.0-canary.1633+5b0f645b9",
"lmdb": "2.8.5"
},
"peerDependencies": {
"@parcel/core": "^2.0.0-canary.1630+98a6b8ed7"
"@parcel/core": "^2.0.0-canary.1631+5b0f645b9"
},

@@ -44,3 +44,3 @@ "devDependencies": {

},
"gitHead": "98a6b8ed78a3f977e3b2fecb2561ac831f88d221"
"gitHead": "5b0f645b9104f2a9fcd40a88c22859673e75e67a"
}

@@ -144,2 +144,8 @@ // @flow strict-local

): Promise<void> {
const previousEntry = await this.get<LargeBlobEntry>(key);
if (previousEntry) {
await this.store.remove(key);
await this.fsCache.deleteLargeBlob(previousEntry.largeBlobKey);
}
// $FlowFixMe flow libs are outdated but we only support node>16 so randomUUID is present

@@ -146,0 +152,0 @@ const largeBlobKey = `${key}_${crypto.randomUUID()}`;

@@ -5,2 +5,3 @@ // @flow

import * as tempy from 'tempy';
import fs from 'fs';
import assert from 'assert';

@@ -11,5 +12,6 @@ import path from 'path';

describe('LMDBCache', () => {
let tmpDir: string;
let lmdbCache: Cache;
beforeEach(async () => {
const tmpDir = path.join(tempy.directory(), 'LMDBCache');
tmpDir = path.join(tempy.directory(), 'LMDBCache');
mkdirp.sync(tmpDir);

@@ -63,2 +65,21 @@ lmdbCache = new LMDBCache(tmpDir);

});
it('setting multiple large blobs and then removing them will leave the disk empty', async () => {
assert(!(await lmdbCache.has('test-key')), 'LMDB did not start empty');
const filesAtStart = fs.readdirSync(tmpDir);
const buffer = Buffer.from([1, 2, 3, 4]);
await lmdbCache.setLargeBlob('test-key', buffer);
await lmdbCache.setLargeBlob('test-key', buffer);
await lmdbCache.setLargeBlob('test-key', buffer);
await lmdbCache.setLargeBlob('other-key', buffer);
await lmdbCache.setLargeBlob('other-key', buffer);
await lmdbCache.setLargeBlob('other-key', buffer);
await lmdbCache.deleteLargeBlob('test-key');
await lmdbCache.deleteLargeBlob('other-key');
const filesAtEnd = fs.readdirSync(tmpDir);
assert.deepEqual(filesAtStart, filesAtEnd);
});
});
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc