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

@tus/file-store

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tus/file-store - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

2

dist/configstores/FileConfigstore.d.ts
import { Upload } from '@tus/server';
import PQueue from 'p-queue';
import { Configstore } from './Types';

@@ -10,3 +9,2 @@ /**

directory: string;
queue: PQueue;
constructor(path: string);

@@ -13,0 +11,0 @@ get(key: string): Promise<Upload | undefined>;

20

dist/configstores/FileConfigstore.js

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

const node_path_1 = __importDefault(require("node:path"));
const p_queue_1 = __importDefault(require("p-queue"));
/**

@@ -18,7 +17,6 @@ * FileConfigstore writes the `Upload` JSON metadata to disk next the uploaded file itself.

this.directory = path;
this.queue = new p_queue_1.default({ concurrency: 1 });
}
async get(key) {
try {
const buffer = await this.queue.add(() => promises_1.default.readFile(this.resolve(key), 'utf8'));
const buffer = await promises_1.default.readFile(this.resolve(key), 'utf8');
return JSON.parse(buffer);

@@ -31,15 +29,13 @@ }

async set(key, value) {
await this.queue.add(() => promises_1.default.writeFile(this.resolve(key), JSON.stringify(value)));
await promises_1.default.writeFile(this.resolve(key), JSON.stringify(value));
}
async delete(key) {
await this.queue.add(() => promises_1.default.rm(this.resolve(key)));
await promises_1.default.rm(this.resolve(key));
}
async list() {
return this.queue.add(async () => {
const files = await promises_1.default.readdir(this.directory);
const sorted = files.sort((a, b) => a.localeCompare(b));
const name = (file) => node_path_1.default.basename(file, '.json');
// To only return tus file IDs we check if the file has a corresponding JSON info file
return sorted.filter((file, idx) => idx < sorted.length - 1 && name(file) === name(sorted[idx + 1]));
});
const files = await promises_1.default.readdir(this.directory);
const sorted = files.sort((a, b) => a.localeCompare(b));
const name = (file) => node_path_1.default.basename(file, '.json');
// To only return tus file IDs we check if the file has a corresponding JSON info file
return sorted.filter((file, idx) => idx < sorted.length - 1 && name(file) === name(sorted[idx + 1]));
}

@@ -46,0 +42,0 @@ resolve(key) {

{
"$schema": "https://json.schemastore.org/package.json",
"name": "@tus/file-store",
"version": "1.0.1",
"version": "1.1.0",
"description": "Local file storage for @tus/server",

@@ -24,7 +24,6 @@ "main": "dist/index.js",

"dependencies": {
"debug": "^4.3.4",
"p-queue": "^6.6.2"
"debug": "^4.3.4"
},
"devDependencies": {
"@tus/server": "^1.0.0",
"@tus/server": "^1.0.1",
"@types/debug": "^4.1.8",

@@ -40,3 +39,3 @@ "@types/mocha": "^10.0.1",

"peerDependencies": {
"@tus/server": "^1.0.0"
"@tus/server": "^1.0.1"
},

@@ -43,0 +42,0 @@ "optionalDependencies": {

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