
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
file-promisify
Advanced tools
Utilities for file and image handling, in Browsers, with Promise.
$ npm install --save file-promisify
<script src="https://cdn.jsdelivr.net/npm/file-promisify/dist/index.umd.js"></script>
import Files from 'file-promisify'
const instance = new Files()
/** open file dialog */
instance.select()
.then(([blob]) => {})
.catch(error => {})
/** open file dialog for selecting multiple files */
instance.select({ multiple: true })
.then(blobs => {})
.catch(error => {})
/** open file dialog for selecting an image file */
instance.select({ accept: 'image/*' })
.then(blob => {
/** wrap image into maximum 128 × 128 pixels */
Files.processImage({ blob, width: 128, height: 128, crop: false })
.then(dataUrl => {})
.catch(error => {})
/** crop image into 128 × 128 pixels exactly */
Files.processImage({ blob, width: 128, height: 128, crop: true })
.then(dataUrl => {})
.catch(error => {})
})
.catch(error => {})
/** open directory dialog for selecting a directory (only webkit) */
instance.selectDirectory()
.then(blobs => {})
.catch(error => {})
instance.select({ multiple: [multiple], accept: [accept] })Open a file dialog.
| Parameter | Type | Description | Default |
|---|---|---|---|
multiple | Boolean | Multiple selection or not. | false |
accept | String | MIME type accepted. | '*/*' |
Promise<FileList>instance.selectDirectory()Open a directory dialog. (only webkit)
Promise<FileList>Files.processImage({ blob: <blob>, width: [width], height: [height], crop: [crop] })Process image.
| Parameter | Type | Description | Default |
|---|---|---|---|
blob | Blob | The blob of image data. | (required) |
width | Number | Target width. | null |
height | Number | Target height. | null |
crop | Boolean | Should crop or not. true for cropping image into dimension exactly, while false for wrapping image into the maximum dimension. | false |
Promise<String>Files.urlToImage(<url>)Fetch image URL into Image instance.
| Parameter | Type | Description | Default |
|---|---|---|---|
url | String | The URL of image. | (required) |
Promise<Image>Files.blobToDataUrl(<blob>)Transform Blob to data URL.
| Parameter | Type | Description | Default |
|---|---|---|---|
blob | Blob | The blob. | (required) |
Promise<String>Files.dataUrlToBlob(<dataUrl>)Transform data URL to Blob.
| Parameter | Type | Description | Default |
|---|---|---|---|
dataUrl | String | The data url. | (required) |
Promise<Blob>Files.dataUrlToBase64(<dataUrl>)Transform data URL to Base64 encoded string.
| Parameter | Type | Description | Default |
|---|---|---|---|
dataUrl | String | The data url. | (required) |
Promise<String>Files.blobToBase64(<blob>)Transform Blob to Base64 encoded string.
| Parameter | Type | Description | Default |
|---|---|---|---|
blob | Blob | The blob. | (required) |
Promise<String>Files.blobToArrayBuffer(<blob>)Transform Blob to ArrayBuffer.
| Parameter | Type | Description | Default |
|---|---|---|---|
blob | Blob | The blob. | (required) |
Promise<ArrayBuffer>Files.blobToString(<blob>, [encoding])Transform Blob to string.
| Parameter | Type | Description | Default |
|---|---|---|---|
blob | Blob | The blob. | (required) |
encoding | String | The encoding. | 'UTF-8' |
Promise<String>Files.stringToBlob(<string>, [type])Transform string to Blob.
| Parameter | Type | Description | Default |
|---|---|---|---|
string | String | The string. | (required) |
type | String | The MIME type. | 'application/octet-stream' |
Promise<Blob>Files.stringToByteArray(<string>)Transform string to byte array.
| Parameter | Type | Description | Default |
|---|---|---|---|
string | String | The string. | (required) |
Promise<Uint8Array>Files.getImageOrientation(<blob>)Get image orientation value from Blob.
| Parameter | Type | Description | Default |
|---|---|---|---|
blob | Blob | The blob of image data. | (required) |
Promise<Number>Files.getMimeTypeFromDataUrl(<dataUrl>)Get MIME type from data URL.
| Parameter | Type | Description | Default |
|---|---|---|---|
dataUrl | String | The data url. | (required) |
Promise<String>FAQs
Utilities for file and image handling, in Browsers, with Promise.
We found that file-promisify demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.