{"id":32639341,"url":"https://github.com/valesdev/file-promisify","last_synced_at":"2026-01-20T16:58:46.667Z","repository":{"id":57235627,"uuid":"273684072","full_name":"valesdev/file-promisify","owner":"valesdev","description":null,"archived":false,"fork":false,"pushed_at":"2025-10-30T08:49:17.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-30T13:42:44.129Z","etag":null,"topics":["file","files","image","promise"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/valesdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-20T10:11:48.000Z","updated_at":"2025-10-30T08:49:21.000Z","dependencies_parsed_at":"2022-08-23T15:50:16.088Z","dependency_job_id":null,"html_url":"https://github.com/valesdev/file-promisify","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/valesdev/file-promisify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valesdev%2Ffile-promisify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valesdev%2Ffile-promisify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valesdev%2Ffile-promisify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valesdev%2Ffile-promisify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valesdev","download_url":"https://codeload.github.com/valesdev/file-promisify/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valesdev%2Ffile-promisify/sbom","scorecard":{"id":915132,"data":{"date":"2025-08-11","repo":{"name":"github.com/valesdev/file-promisify","commit":"b917f805f9674ec802d065de43aa7ae7821b691f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/10 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T20:41:08.827Z","repository_id":57235627,"created_at":"2025-08-24T20:41:08.827Z","updated_at":"2025-08-24T20:41:08.827Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281914569,"owners_count":26583084,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-31T02:00:07.401Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file","files","image","promise"],"created_at":"2025-10-31T02:10:55.895Z","updated_at":"2025-10-31T02:10:58.635Z","avatar_url":"https://github.com/valesdev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# file-promisify\n\n[![Version](https://img.shields.io/npm/v/file-promisify.svg)](https://www.npmjs.com/package/file-promisify)\n[![Downloads](https://img.shields.io/npm/dm/file-promisify.svg)](https://npmcharts.com/compare/file-promisify?minimal=true)\n[![License](https://img.shields.io/npm/l/file-promisify.svg)](https://www.npmjs.com/package/file-promisify)\n\nUtilities for file and image handling, in Browsers, with Promise.\n\n[Live demo](https://open.vales.io/file-promisify/demo.html)\n\n## Installation\n\n### Node.js\n\n```sh\n$ npm install --save file-promisify\n```\n\n### Browser via CDN\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/file-promisify/dist/index.umd.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n```js\nimport Files from 'file-promisify'\n\nconst instance = new Files()\n\n/** open file dialog */\ninstance.select()\n  .then(([blob]) =\u003e {})\n  .catch(error =\u003e {})\n\n/** open file dialog for selecting multiple files */\ninstance.select({ multiple: true })\n  .then(blobs =\u003e {})\n  .catch(error =\u003e {})\n\n/** open file dialog for selecting an image file */\ninstance.select({ accept: 'image/*' })\n  .then(blob =\u003e {\n    /** wrap image into maximum 128 × 128 pixels */\n    Files.processImage({ blob, width: 128, height: 128, crop: false })\n      .then(dataUrl =\u003e {})\n      .catch(error =\u003e {})\n\n    /** crop image into 128 × 128 pixels exactly */\n    Files.processImage({ blob, width: 128, height: 128, crop: true })\n      .then(dataUrl =\u003e {})\n      .catch(error =\u003e {})\n  })\n  .catch(error =\u003e {})\n\n/** open directory dialog for selecting a directory (only webkit) */\ninstance.selectDirectory()\n  .then(blobs =\u003e {})\n  .catch(error =\u003e {})\n```\n\n## API\n\n### `instance.select({ multiple: [multiple], accept: [accept] })`\n\nOpen a file dialog.\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `multiple` | Boolean | Multiple selection or not. | `false` |\n| `accept` | String | MIME type accepted. | `'*/*'` |\n\n- Returns: `Promise\u003cFileList\u003e`\n\n### `instance.selectDirectory()`\n\nOpen a directory dialog. (only webkit)\n\n- Returns: `Promise\u003cFileList\u003e`\n\n### `Files.processImage({ blob: \u003cblob\u003e, width: [width], height: [height], crop: [crop] })`\n\nProcess image.\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `blob` | Blob | The blob of image data. | (required) |\n| `width` | Number | Target width. | `null` |\n| `height` | Number | Target height. | `null` |\n| `crop` | Boolean | Should crop or not. `true` for cropping image into dimension exactly, while `false` for wrapping image into the maximum dimension. | `false` |\n\n- Returns: `Promise\u003cString\u003e`\n\n### `Files.urlToImage(\u003curl\u003e)`\n\nFetch image URL into Image instance.\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `url` | String | The URL of image. | (required) |\n\n- Returns: `Promise\u003cImage\u003e`\n\n### `Files.blobToDataUrl(\u003cblob\u003e)`\n\nTransform Blob to data URL.\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `blob` | Blob | The blob. | (required) |\n\n- Returns: `Promise\u003cString\u003e`\n\n### `Files.dataUrlToBlob(\u003cdataUrl\u003e)`\n\nTransform data URL to Blob.\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `dataUrl` | String | The data url. | (required) |\n\n- Returns: `Promise\u003cBlob\u003e`\n\n### `Files.dataUrlToBase64(\u003cdataUrl\u003e)`\n\nTransform data URL to Base64 encoded string.\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `dataUrl` | String | The data url. | (required) |\n\n- Returns: `Promise\u003cString\u003e`\n\n### `Files.blobToBase64(\u003cblob\u003e)`\n\nTransform Blob to Base64 encoded string.\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `blob` | Blob | The blob. | (required) |\n\n- Returns: `Promise\u003cString\u003e`\n\n### `Files.blobToArrayBuffer(\u003cblob\u003e)`\n\nTransform Blob to ArrayBuffer.\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `blob` | Blob | The blob. | (required) |\n\n- Returns: `Promise\u003cArrayBuffer\u003e`\n\n### `Files.blobToString(\u003cblob\u003e, [encoding])`\n\nTransform Blob to string.\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `blob` | Blob | The blob. | (required) |\n| `encoding` | String | The encoding. | `'UTF-8'` |\n\n- Returns: `Promise\u003cString\u003e`\n\n### `Files.stringToBlob(\u003cstring\u003e, [type])`\n\nTransform string to Blob.\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `string` | String | The string. | (required) |\n| `type` | String | The MIME type. | `'application/octet-stream'` |\n\n- Returns: `Promise\u003cBlob\u003e`\n\n### `Files.stringToByteArray(\u003cstring\u003e)`\n\nTransform string to byte array.\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `string` | String | The string. | (required) |\n\n- Returns: `Promise\u003cUint8Array\u003e`\n\n### `Files.getImageOrientation(\u003cblob\u003e)`\n\nGet image orientation value from Blob.\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `blob` | Blob | The blob of image data. | (required) |\n\n- Returns: `Promise\u003cNumber\u003e`\n\n### `Files.getMimeTypeFromDataUrl(\u003cdataUrl\u003e)`\n\nGet MIME type from data URL.\n\n| Parameter | Type | Description | Default |\n| --- | --- | --- | --- |\n| `dataUrl` | String | The data url. | (required) |\n\n- Returns: `Promise\u003cString\u003e`\n\n## License\n\n[MIT](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalesdev%2Ffile-promisify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalesdev%2Ffile-promisify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalesdev%2Ffile-promisify/lists"}