Socket
Socket
Sign inDemoInstall

@miniflare/storage-file

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@miniflare/storage-file - npm Package Compare versions

Comparing version 2.0.0-rc.2 to 2.0.0-rc.3

2

dist/src/index.d.ts

@@ -24,4 +24,4 @@ import { Clock } from '@miniflare/shared';

export declare type FileStorageErrorCode = "ERR_TRAVERSAL";
export declare type FileStorageErrorCode = "ERR_TRAVERSAL" | "ERR_NAMESPACE_KEY_CHILD";
export { }

@@ -83,11 +83,17 @@ // packages/storage-file/src/index.ts

return;
const value = await readFile(filePath);
if (value === void 0)
return;
const meta = await this.meta(filePath);
return {
value: viewToArray(value),
expiration: meta.expiration,
metadata: meta.metadata
};
try {
const value = await readFile(filePath);
if (value === void 0)
return;
const meta = await this.meta(filePath);
return {
value: viewToArray(value),
expiration: meta.expiration,
metadata: meta.metadata
};
} catch (e) {
if (e.code === "ENOTDIR")
return;
throw e;
}
}

@@ -99,3 +105,10 @@ async put(key, { value, expiration, metadata }) {

}
await writeFile(filePath, value);
try {
await writeFile(filePath, value);
} catch (e) {
if (e.code !== "EEXIST")
throw e;
throw new FileStorageError("ERR_NAMESPACE_KEY_CHILD", 'Cannot put key "' + key + `" as a parent namespace is also a key.
This is a limitation of Miniflare's file-system storage. Please use in-memory/Redis storage instead, or change your key layout.`, e);
}
const metaFilePath = filePath + metaSuffix;

@@ -112,5 +125,11 @@ if (expiration !== void 0 || metadata !== void 0 || sanitised) {

return false;
const existed = await deleteFile(filePath);
await deleteFile(filePath + metaSuffix);
return existed;
try {
const existed = await deleteFile(filePath);
await deleteFile(filePath + metaSuffix);
return existed;
} catch (e) {
if (e.code === "ENOTDIR")
return false;
throw e;
}
}

@@ -117,0 +136,0 @@ async listAllMaybeExpired() {

{
"name": "@miniflare/storage-file",
"version": "2.0.0-rc.2",
"version": "2.0.0-rc.3",
"description": "File-system storage module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers",

@@ -39,8 +39,8 @@ "keywords": [

"dependencies": {
"@miniflare/shared": "2.0.0-rc.2",
"@miniflare/storage-memory": "2.0.0-rc.2"
"@miniflare/shared": "2.0.0-rc.3",
"@miniflare/storage-memory": "2.0.0-rc.3"
},
"devDependencies": {
"@miniflare/shared-test": "2.0.0-rc.2"
"@miniflare/shared-test": "2.0.0-rc.3"
}
}

Sorry, the diff of this file is not supported yet

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