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

@c8/simple-promised-file

Package Overview
Dependencies
Maintainers
5
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@c8/simple-promised-file - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

10

examples/image.js

@@ -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 @@ */

7

package.json
{
"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": {

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