@apoyo/files
Advanced tools
Comparing version 0.0.3 to 0.1.0
@@ -40,3 +40,3 @@ import { Exception } from '@apoyo/std'; | ||
*/ | ||
interface DriverContract { | ||
interface Drive { | ||
/** | ||
@@ -156,3 +156,3 @@ * Name of the driver | ||
interface LocalDriverConfig { | ||
interface LocalDriveConfig { | ||
/** | ||
@@ -173,3 +173,3 @@ * Root directory in which to search for your files on your local filesystem | ||
*/ | ||
declare class LocalDriver implements DriverContract { | ||
declare class LocalDrive implements Drive { | ||
private _config; | ||
@@ -185,3 +185,3 @@ /** | ||
name: 'local'; | ||
constructor(_config: LocalDriverConfig); | ||
constructor(_config: LocalDriveConfig); | ||
/** | ||
@@ -243,3 +243,3 @@ * Make absolute path to a given location | ||
interface FakeDriverConfig { | ||
interface FakeDriveConfig { | ||
/** | ||
@@ -254,5 +254,5 @@ * Configure how `getUrl` and `getSignedUrl` computes the URL for a given file | ||
/** | ||
* Memory driver is mainly used for testing | ||
* Memory drive is mainly used for testing | ||
*/ | ||
declare class FakeDriver implements DriverContract { | ||
declare class FakeDrive implements Drive { | ||
private _config; | ||
@@ -267,3 +267,3 @@ /** | ||
name: 'fake'; | ||
constructor(_config: FakeDriverConfig); | ||
constructor(_config?: FakeDriveConfig); | ||
/** | ||
@@ -329,2 +329,2 @@ * Make absolute path to a given location | ||
export { CannotCopyFileException, CannotDeleteFileException, CannotGenerateUrlException, CannotGetMetaDataException, CannotMoveFileException, CannotReadFileException, CannotWriteFileException, ContentHeaders, DriveFileStats, DriverContract, FakeDriver, FakeDriverConfig, FileException, LocalDriver, LocalDriverConfig, SignedUrlOptions, WriteOptions }; | ||
export { CannotCopyFileException, CannotDeleteFileException, CannotGenerateUrlException, CannotGetMetaDataException, CannotMoveFileException, CannotReadFileException, CannotWriteFileException, ContentHeaders, Drive, DriveFileStats, FakeDrive, FakeDriveConfig as FakeDriverConfig, FileException, LocalDrive, LocalDriveConfig, SignedUrlOptions, WriteOptions }; |
@@ -32,5 +32,5 @@ var __create = Object.create; | ||
CannotWriteFileException: () => CannotWriteFileException, | ||
FakeDriver: () => FakeDriver, | ||
FakeDrive: () => FakeDrive, | ||
FileException: () => FileException, | ||
LocalDriver: () => LocalDriver | ||
LocalDrive: () => LocalDrive | ||
}); | ||
@@ -104,3 +104,3 @@ module.exports = __toCommonJS(src_exports); | ||
// src/drivers/local.ts | ||
var LocalDriver = class { | ||
var LocalDrive = class { | ||
constructor(_config) { | ||
@@ -209,4 +209,5 @@ this._config = _config; | ||
var import_path2 = require("path"); | ||
var FakeDriver = class { | ||
constructor(_config) { | ||
var import_std2 = require("@apoyo/std"); | ||
var FakeDrive = class { | ||
constructor(_config = {}) { | ||
this._config = _config; | ||
@@ -235,4 +236,6 @@ } | ||
reject(new CannotReadFileException(location, error)); | ||
} else if (!data) { | ||
reject(new CannotReadFileException(location, new import_std2.Exception("Undefined data"))); | ||
} else { | ||
resolve(data); | ||
resolve(typeof data === "string" ? Buffer.from(data) : data); | ||
} | ||
@@ -354,5 +357,5 @@ }); | ||
CannotWriteFileException, | ||
FakeDriver, | ||
FakeDrive, | ||
FileException, | ||
LocalDriver | ||
LocalDrive | ||
}); |
{ | ||
"name": "@apoyo/files", | ||
"version": "0.0.3", | ||
"version": "0.1.0", | ||
"description": "Utils focused around files management", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34185
982