@c8/simple-promised-file
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -10,2 +10,3 @@ 'use strict' | ||
console.log(img.size) | ||
img.mime | ||
@@ -15,5 +16,2 @@ .then((mime) => { | ||
}) | ||
.catch((err) => { | ||
console.log(err) | ||
}) | ||
@@ -24,5 +22,2 @@ img.isImage | ||
}) | ||
.catch((err) => { | ||
console.log(err) | ||
}) | ||
@@ -36,2 +31,5 @@ // Async getters | ||
// generate a unique name for a file | ||
console.log(img.uniqueName) | ||
// Image editing | ||
@@ -38,0 +36,0 @@ return img |
@@ -6,2 +6,3 @@ 'use strict' | ||
const createError = require('create-error') | ||
const shortId = require('shortid') | ||
@@ -42,2 +43,20 @@ /** | ||
/** | ||
* A unique file name based on file's extension | ||
* | ||
* @returns {string} | ||
*/ | ||
get uniqueName () { | ||
return `${shortId.generate()}.${this.extension}` | ||
} | ||
/** | ||
* A unique file name based on file's extension | ||
* | ||
* @returns {string} | ||
*/ | ||
get extension () { | ||
return this.path.split('.').pop() | ||
} | ||
/** | ||
* @returns {ReadError} Cannot read a file in this.path | ||
@@ -44,0 +63,0 @@ */ |
{ | ||
"name": "@c8/simple-promised-file", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A small promise library with basic file functionality and promise-wrapped gm image module.", | ||
@@ -15,3 +15,3 @@ "main": "index.js", | ||
"engines": { | ||
"node": "4.3.1" | ||
"node": "4.x.x" | ||
}, | ||
@@ -35,3 +35,4 @@ "repository": { | ||
"mime": "^1.3.4", | ||
"read-chunk": "^2.0.0" | ||
"read-chunk": "^2.0.0", | ||
"shortid": "^2.2.6" | ||
}, | ||
@@ -38,0 +39,0 @@ "devDependencies": { |
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
604275
326
8
+ Addedshortid@^2.2.6
+ Addednanoid@2.1.11(transitive)
+ Addedshortid@2.2.16(transitive)