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

@file-storage/local

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@file-storage/local - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

5

dist/local-driver.d.ts
/// <reference types="node" />
import { ReadStream } from 'fs';
import fs, { ReadStream } from 'fs';
import { Stream } from 'stream';

@@ -11,2 +11,3 @@ import { Driver, DriverName, LocalDiskConfig, PutResult } from '@file-storage/common';

protected errorHandler(error: any): void;
protected stats(path: string): Promise<fs.Stats>;
url(path: string): string;

@@ -19,4 +20,6 @@ exists(path: string): Promise<boolean>;

delete(path: string): Promise<boolean>;
copy(path: string, newPath: string): Promise<void>;
move(path: string, newPath: string): Promise<void>;
makeDir(path: string): Promise<string>;
removeDir(dir: string): Promise<string>;
}

59

dist/local-driver.js

@@ -34,2 +34,14 @@ "use strict";

}
stats(path) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => {
fs_1.default.stat(this.rootPath(path), (err, stats) => {
if (err) {
return reject(err);
}
resolve(stats);
});
});
});
}
url(path) {

@@ -50,21 +62,11 @@ return `${process.env.APP_URL}/${path}`;

size(path) {
return new Promise((resolve, reject) => {
fs_1.default.stat(this.rootPath(path), (err, stats) => {
if (err) {
reject(err);
return;
}
resolve(stats.size);
});
return __awaiter(this, void 0, void 0, function* () {
const stats = yield this.stats(path);
return stats.size;
});
}
lastModified(path) {
return new Promise((resolve, reject) => {
fs_1.default.stat(this.rootPath(path), (err, stats) => {
if (err) {
reject(err);
return;
}
resolve(stats.ctimeMs);
});
return __awaiter(this, void 0, void 0, function* () {
const stats = yield this.stats(path);
return stats.ctimeMs;
});

@@ -98,4 +100,3 @@ }

if (err) {
reject(err);
return;
return reject(err);
}

@@ -106,2 +107,24 @@ resolve(true);

}
copy(path, newPath) {
common_1.ensureDirectoryExistence(this.rootPath(newPath));
return new Promise((resolve, reject) => {
fs_1.default.copyFile(this.rootPath(path), this.rootPath(newPath), (err) => {
if (err) {
return reject(err);
}
resolve();
});
});
}
move(path, newPath) {
common_1.ensureDirectoryExistence(this.rootPath(newPath));
return new Promise((resolve, reject) => {
fs_1.default.rename(this.rootPath(path), this.rootPath(newPath), (err) => {
if (err) {
return reject(err);
}
resolve();
});
});
}
makeDir(path) {

@@ -108,0 +131,0 @@ return __awaiter(this, void 0, void 0, function* () {

{
"name": "@file-storage/local",
"version": "1.2.0",
"version": "1.2.1",
"description": "Local driver for file-storage",

@@ -30,7 +30,7 @@ "author": "Dang Nguyen <haidang009@gmail.com>",

"devDependencies": {
"@file-storage/common": "^1.2.0",
"@file-storage/common": "^1.2.1",
"rimraf": "~3.0.2",
"typescript": "~4.3.5"
},
"gitHead": "e31fa799b710b85e0c3029b08dfba2a5e8b3a8db"
"gitHead": "5c1da4d6f54f2489984d044d11de324402f32a0b"
}
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