@jimp/core
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -0,1 +1,17 @@ | ||
# v1.4.0 (Sat Sep 07 2024) | ||
#### 🚀 Enhancement | ||
- Let Jimp.read accept a Buffer [#1332](https://github.com/jimp-dev/jimp/pull/1332) ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
#### ⚠️ Pushed to `main` | ||
- fix docs build ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
#### Authors: 1 | ||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
--- | ||
# v1.3.0 (Wed Sep 04 2024) | ||
@@ -2,0 +18,0 @@ |
@@ -105,3 +105,3 @@ "use strict"; | ||
/** | ||
* Create a Jimp instance from a URL or a file path | ||
* Create a Jimp instance from a URL, a file path, or a Buffer | ||
* @example | ||
@@ -119,4 +119,7 @@ * ```ts | ||
static async read(url) { | ||
if (Buffer.isBuffer(url) || url instanceof ArrayBuffer) { | ||
return this.fromBuffer(url); | ||
} | ||
if ((0, file_ops_1.existsSync)(url)) { | ||
return Jimp.fromBuffer(await (0, file_ops_1.readFile)(url)); | ||
return this.fromBuffer(await (0, file_ops_1.readFile)(url)); | ||
} | ||
@@ -123,0 +126,0 @@ const [fetchErr, response] = await (0, await_to_js_1.to)(fetch(url)); |
@@ -82,3 +82,3 @@ import { Edge } from "@jimp/types"; | ||
/** | ||
* Create a Jimp instance from a URL or a file path | ||
* Create a Jimp instance from a URL, a file path, or a Buffer | ||
* @example | ||
@@ -96,4 +96,7 @@ * ```ts | ||
static async read(url) { | ||
if (Buffer.isBuffer(url) || url instanceof ArrayBuffer) { | ||
return this.fromBuffer(url); | ||
} | ||
if (existsSync(url)) { | ||
return Jimp.fromBuffer(await readFile(url)); | ||
return this.fromBuffer(await readFile(url)); | ||
} | ||
@@ -100,0 +103,0 @@ const [fetchErr, response] = await to(fetch(url)); |
{ | ||
"name": "@jimp/core", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"repository": "jimp-dev/jimp", | ||
@@ -18,5 +18,5 @@ "engines": { | ||
"dependencies": { | ||
"@jimp/file-ops": "1.3.0", | ||
"@jimp/types": "1.3.0", | ||
"@jimp/utils": "1.3.0", | ||
"@jimp/file-ops": "1.4.0", | ||
"@jimp/types": "1.4.0", | ||
"@jimp/utils": "1.4.0", | ||
"await-to-js": "^3.0.0", | ||
@@ -28,5 +28,5 @@ "exif-parser": "^0.1.12", | ||
"devDependencies": { | ||
"@jimp/config-eslint": "1.3.0", | ||
"@jimp/config-typescript": "1.3.0", | ||
"@jimp/test-utils": "1.3.0", | ||
"@jimp/config-eslint": "1.4.0", | ||
"@jimp/config-typescript": "1.4.0", | ||
"@jimp/test-utils": "1.4.0", | ||
"@types/file-type": "^10.9.1", | ||
@@ -38,2 +38,3 @@ "@types/mime": "^3.0.4", | ||
"typescript": "^5.5.4", | ||
"vite-plugin-node-polyfills": "^0.22.0", | ||
"vitest": "^2.0.5" | ||
@@ -71,3 +72,3 @@ }, | ||
"module": "./dist/esm/index.js", | ||
"gitHead": "fb52a357ac774d6314a319fe43f8d0d022ac214c" | ||
"gitHead": "c1b91e9007f17d0702894bd9bfab8215cff764f9" | ||
} |
@@ -204,3 +204,3 @@ import { Bitmap, Format, JimpClass, Edge } from "@jimp/types"; | ||
/** | ||
* Create a Jimp instance from a URL or a file path | ||
* Create a Jimp instance from a URL, a file path, or a Buffer | ||
* @example | ||
@@ -217,5 +217,9 @@ * ```ts | ||
*/ | ||
static async read(url: string) { | ||
static async read(url: string | Buffer | ArrayBuffer) { | ||
if (Buffer.isBuffer(url) || url instanceof ArrayBuffer) { | ||
return this.fromBuffer(url); | ||
} | ||
if (existsSync(url)) { | ||
return Jimp.fromBuffer(await readFile(url)); | ||
return this.fromBuffer(await readFile(url)); | ||
} | ||
@@ -222,0 +226,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
371785
7558
11
+ Added@jimp/file-ops@1.4.0(transitive)
+ Added@jimp/types@1.4.0(transitive)
+ Added@jimp/utils@1.4.0(transitive)
- Removed@jimp/file-ops@1.3.0(transitive)
- Removed@jimp/types@1.3.0(transitive)
- Removed@jimp/utils@1.3.0(transitive)
Updated@jimp/file-ops@1.4.0
Updated@jimp/types@1.4.0
Updated@jimp/utils@1.4.0