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

@ducktors/storagebus-local

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ducktors/storagebus-local - npm Package Compare versions

Comparing version 0.11.0 to 0.12.0

1

dist/local.d.ts

@@ -20,4 +20,3 @@ /// <reference types="node" />

move(filePath: string, destFilePath: string): Promise<string>;
static getTmpSubFolder(subFolder?: string): Promise<string>;
}
export {};

27

dist/local.js

@@ -5,3 +5,2 @@ "use strict";

const tslib_1 = require("tslib");
const node_crypto_1 = require("node:crypto");
const node_fs_1 = require("node:fs");

@@ -22,6 +21,13 @@ const promises_1 = tslib_1.__importDefault(require("node:fs/promises"));

});
this.bucket = opts.bucket ?? opts.rootFolder;
let rootFolder = opts.bucket ?? opts.rootFolder;
if (!(0, node_path_1.isAbsolute)(rootFolder)) {
const tmpDir = (0, node_os_1.tmpdir)();
rootFolder = (0, node_path_1.join)(tmpDir, rootFolder);
}
(0, node_fs_1.mkdirSync)(rootFolder, { recursive: true });
this.bucket = rootFolder;
}
async write(filePath, fileReadable) {
const path = (0, node_path_1.join)(this.bucket, filePath);
await promises_1.default.mkdir((0, node_path_1.dirname)(path), { recursive: true });
await (0, promises_2.pipeline)(fileReadable, (0, node_fs_1.createWriteStream)(path));

@@ -40,3 +46,6 @@ return filePath;

}
return false;
if (err.code === 'ENOENT') {
return false;
}
throw err;
}

@@ -55,2 +64,3 @@ }

const destPath = (0, node_path_1.join)(this.bucket, destFilePath);
await promises_1.default.mkdir((0, node_path_1.dirname)(destPath), { recursive: true });
await promises_1.default.copyFile(path, destPath);

@@ -62,2 +72,3 @@ return destFilePath;

const destPath = (0, node_path_1.join)(this.bucket, destFilePath);
await promises_1.default.mkdir((0, node_path_1.dirname)(destPath), { recursive: true });
try {

@@ -77,14 +88,4 @@ await promises_1.default.rename(path, destPath);

}
static async getTmpSubFolder(subFolder) {
if (!subFolder) {
subFolder = (0, node_crypto_1.randomUUID)();
}
const path = (0, node_path_1.join)((0, node_os_1.tmpdir)(), subFolder);
await promises_1.default.mkdir(path, {
recursive: true,
});
return path;
}
}
exports.Storage = Storage;
//# sourceMappingURL=local.js.map
{
"name": "@ducktors/storagebus-local",
"version": "0.11.0",
"version": "0.12.0",
"description": "",

@@ -5,0 +5,0 @@ "license": "MIT",

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