@file-storage/core
Advanced tools
Comparing version 1.2.5 to 1.2.7
/// <reference types="node" /> | ||
import { Stream } from 'stream'; | ||
import { DiskConfig, Driver, PutResult } from '@file-storage/common'; | ||
import { DiskConfig, Driver, PutResult, ImageStats } from '@file-storage/common'; | ||
import { BuitInDiskConfig, StorageConfiguration } from './types'; | ||
@@ -41,3 +41,6 @@ declare class StorageClass implements Driver { | ||
uploadImageFromExternalUri(uri: string, path: string, ignoreHeaderContentType?: boolean): Promise<any>; | ||
imageStats(path: string): Promise<import("@file-storage/common").ImageStats>; | ||
imageStats(path: string, keepBuffer: true): Promise<ImageStats & { | ||
buffer: Buffer; | ||
}>; | ||
imageStats(path: string, keepBuffer?: boolean): Promise<ImageStats>; | ||
} | ||
@@ -44,0 +47,0 @@ /** |
@@ -55,3 +55,3 @@ "use strict"; | ||
if (!driver) { | ||
// Throw error missing bult-in driver package. | ||
// Throw error missing built-in driver package. | ||
if (Object.values(common_1.DriverName).includes(diskConfig.driver)) { | ||
@@ -167,4 +167,4 @@ throw new Error(`Please install \`@file-storage/${diskConfig.driver}\` for ${diskConfig.driver} driver`); | ||
} | ||
imageStats(path) { | ||
return this.defaultDisk.imageStats(path); | ||
imageStats(path, keepBuffer = false) { | ||
return this.defaultDisk.imageStats(path, keepBuffer); | ||
} | ||
@@ -171,0 +171,0 @@ } |
{ | ||
"name": "@file-storage/core", | ||
"version": "1.2.5", | ||
"version": "1.2.7", | ||
"description": "> TODO: description", | ||
@@ -30,11 +30,11 @@ "author": "Dang Nguyen <haidang009@gmail.com>", | ||
"dependencies": { | ||
"@file-storage/local": "^1.2.3", | ||
"@file-storage/local": "^1.2.7", | ||
"uuid": "^8.3.2" | ||
}, | ||
"devDependencies": { | ||
"@file-storage/common": "^1.2.3", | ||
"@file-storage/common": "^1.2.7", | ||
"rimraf": "~3.0.2", | ||
"typescript": "~4.3.5" | ||
}, | ||
"gitHead": "55ac40d890f438108cb3304e6ccf302514022014" | ||
"gitHead": "9ccdea2b812415261f2f6b96800c3e1fadd4ca7c" | ||
} |
@@ -101,3 +101,3 @@ ``` | ||
If bult-in drivers doesn't match your need, just defines a custom driver by extends `Driver` abstract class: | ||
If built-in drivers doesn't match your need, just defines a custom driver by extends `Driver` abstract class: | ||
@@ -143,3 +143,3 @@ ```typescript | ||
If you want to upload image and also creates many diferent sizes for web resonsive, install this package, it is acting as a plugin, will generates those image sizes automatically: | ||
If you want to upload image and also creates many diferent sizes for web resonsive, install this package, it is acting as a plugin, will generates those images automatically. Images will be generated if the size reach given breakpoints. We provide 3 breakpoints by default: large: 1000, medium: 750, small: 500. And the thumbnail is also generaged by default. | ||
@@ -150,3 +150,3 @@ ```bash | ||
**HINT**: `Image manipulation` only available on Storage facade, If you obtain a specific disk instance, set the second parameter to `true` to obtain a storage instance insteads: | ||
**NOTE**: `Image manipulation` only available on Storage facade, If you obtain a specific disk instance, set the second parameter to `true` to obtain a storage instance insteads: | ||
@@ -157,2 +157,22 @@ ```javascript | ||
#### Image manipulation customize | ||
You can customize responsive formats and thumbnail size: | ||
```typescript | ||
import ImageManipulation from '@file-storage/image-manipulation'; | ||
ImageManipulation.config({ | ||
breakpoints: { | ||
size1: 500, | ||
size2: 800, | ||
}, | ||
thumbnailResizeOptions: { | ||
width: 333, | ||
height: 222, | ||
fit: 'contain', | ||
}, | ||
}); | ||
``` | ||
## TODO | ||
@@ -159,0 +179,0 @@ |
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
17229
269
187
Updated@file-storage/local@^1.2.7