{"id":13769657,"url":"https://github.com/editor-js/attaches","last_synced_at":"2026-02-13T17:38:32.960Z","repository":{"id":34775332,"uuid":"183615561","full_name":"editor-js/attaches","owner":"editor-js","description":"File attachments Block for the Editor.js","archived":false,"fork":false,"pushed_at":"2025-10-16T11:34:18.000Z","size":557,"stargazers_count":71,"open_issues_count":19,"forks_count":67,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-23T08:14:39.334Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/editor-js.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-26T11:19:15.000Z","updated_at":"2025-11-07T03:09:02.000Z","dependencies_parsed_at":"2024-01-12T10:26:51.200Z","dependency_job_id":"e07cb53d-7a84-4ca6-914d-71bd887ed473","html_url":"https://github.com/editor-js/attaches","commit_stats":{"total_commits":91,"total_committers":12,"mean_commits":7.583333333333333,"dds":0.8021978021978022,"last_synced_commit":"e196913ffd5bb2cb2d18633f06abaae9428c60c6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/editor-js/attaches","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/editor-js%2Fattaches","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/editor-js%2Fattaches/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/editor-js%2Fattaches/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/editor-js%2Fattaches/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/editor-js","download_url":"https://codeload.github.com/editor-js/attaches/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/editor-js%2Fattaches/sbom","scorecard":{"id":366751,"data":{"date":"2025-08-11","repo":{"name":"github.com/editor-js/attaches","commit":"e196913ffd5bb2cb2d18633f06abaae9428c60c6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":5,"reason":"Found 4/7 approved changesets -- score normalized to 5","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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/lint-and-build.yml:1","Warn: no topLevel permission defined: .github/workflows/npm-publish.yml:1","Info: no jobLevel write permissions found"],"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint-and-build.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/editor-js/attaches/lint-and-build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint-and-build.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/editor-js/attaches/lint-and-build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/editor-js/attaches/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/editor-js/attaches/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/editor-js/attaches/npm-publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/editor-js/attaches/npm-publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/editor-js/attaches/npm-publish.yml/master?enable=pin","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned"],"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":"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":"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"}},{"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 28 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"32 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-566m-qj78-rww5","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T11:59:14.638Z","repository_id":34775332,"created_at":"2025-08-18T11:59:14.638Z","updated_at":"2025-08-18T11:59:14.638Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29413515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T06:24:03.484Z","status":"ssl_error","status_checked_at":"2026-02-13T06:23:12.830Z","response_time":78,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-08-03T17:00:30.175Z","updated_at":"2026-02-13T17:38:32.920Z","avatar_url":"https://github.com/editor-js.png","language":"JavaScript","funding_links":[],"categories":["Tools"],"sub_categories":["Block Tools"],"readme":"# Attaches Tool\n\nTool for the [Editor.js](https://editorjs.io).\n\nThis tool allows you to attach files to your articles.\n\n![Example of the Attach tool look](https://user-images.githubusercontent.com/3684889/179849070-1af9678b-34fb-4485-860e-39f3b0d26c3e.png)\n\n## Installation\n\nYou can get the package using any of these ways.\n\n### Via NPM / Yarn\n\n```shell\nnpm install @editorjs/attaches\n```\n\n### Load from CDN\n\nYou can load specific version of package from [jsDelivr CDN](https://www.jsdelivr.com/package/npm/@editorjs/attaches).\n\n`https://cdn.jsdelivr.net/npm/@editorjs/attaches@latest`\n\nThen require this script on page with Editor.js through the `\u003cscript src=\"\"\u003e\u003c/script\u003e` tag.\n\n## Usage\n\nAdd a new Tool to the `tools` property of the Editor.js initial config.\n\n```javascript\nimport AttachesTool from '@editorjs/attaches';\n\nvar editor = EditorJS({\n  ...\n\n  tools: {\n    ...\n    attaches: {\n      class: AttachesTool,\n      config: {\n        endpoint: 'http://localhost:8008/uploadFile'\n      }\n    }\n  }\n\n  ...\n});\n```\n\n## Config Params\n\nAttaches Tool supports these configuration parameters:\n\n| Field | Type     | Description        |\n| ----- | -------- | ------------------ |\n| endpoint | `string` | Optional endpoint for file uploading or use uploader |\n| uploader | `{uploadByFile: function}` |Optional custom uploading method or use endpoint|\n| field | `string` | (default: `file`) Name of uploaded file field in POST request |\n| types | `string` | (default: `*`) Mime-types of files that can be [accepted with file selection](https://github.com/codex-team/ajax#accept-string).|\n| buttonText | `string` | (default: `Select file`) Placeholder for file upload button |\n| errorMessage | `string` | (default: `File upload failed`) Message to show if file upload failed |\n| additionalRequestHeaders | `object` | (default: `{}`) Object with any custom headers which will be added to request. Example: `{\"X-CSRF-TOKEN\": \"W5fe2...hR8d1\"}` |\n\n\n## Output data\n\nThis Tool returns `data` with following format\n\n| Field          | Type      | Description                     |\n| -------------- | --------- | ------------------------------- |\n| file           | `object`  | Uploaded file data. Data received from backend uploader. See description below. |\n| title | `string` | File's title. Initially set as uploaded file name. Can be modified by user.          |\n\n### file object \u003ca name=\"file-object\"\u003e\u003c/a\u003e\n\nObject `file` consists of the following fields. All of them are optional, `size` and `extension` are supported by design.\n\n| Field          | Type      | Description                       |\n| -------------- | --------- | ----------------------------------|\n| url            |`string`   | Full public path of uploaded file |\n| size           |`number`   | File's size (expected in bytes, according to Tool's design)                      |\n| name           |`string`   | File's name                       |\n| extension      |`string`   | File's extension                  |\n\n```json\n{\n    \"type\" : \"attaches\",\n    \"data\" : {\n        \"file\": {\n            \"url\" : \"https://www.tesla.com/tesla_theme/assets/img/_vehicle_redesign/roadster_and_semi/roadster/hero.jpg\",\n            \"size\": 91,\n            \"name\": \"hero.jpg\",\n            \"extension\": \"jpg\"\n        },\n        \"title\": \"Hero\"\n    }\n}\n```\n\n## Backend response format\n\nResponse of your uploader **should** cover following format:\n\n```json5\n{\n    \"success\" : 1,\n    \"file\": {\n        // any data you want\n        // for example: url, name, size, title\n    }\n}\n```\n\n**success** - uploading status. 1 for successful, 0 for failed\n\n**file** - uploaded file data. Can contain any data you want to store. All fields will be stored as [file object](#file-object) in output data.\n\nFields supported by the UI of block:\n\n - `title`\n - `size`\n - `extension` (if not present, will be extracted from the `name`)\n - `url`\n\n## Providing custom uploading methods\n\nAs mentioned at the Config Params section, you have an ability to provide own custom uploading method.\nIt is a quite simple: implement `uploadByFile` method and pass them via `uploader` config param.\nThe method return a Promise that resolves with response in a format that described at the [backend response format](#backend-response-format) section.\n\n\n| Method         | Arguments | Return value | Description |\n| -------------- | --------- | -------------| ------------|\n| uploadByFile   | `File`    | `{Promise.\u003c{success, file: {url}}\u003e}` | Upload file to the server and return an uploaded file data |\n\nExample:\n\n```js\nimport AttachesTool from '@editorjs/attaches';\n\nvar editor = EditorJS({\n  ...\n\n  tools: {\n    ...\n    attaches: {\n      class: AttachesTool,\n      config: {\n        /**\n         * Custom uploader\n         */\n        uploader: {\n          /**\n           * Upload file to the server and return an uploaded image data\n           * @param {File} file - file selected from the device or pasted by drag-n-drop\n           * @return {Promise.\u003c{success, file: {url}}\u003e}\n           */\n          uploadByFile(file){\n            // your own uploading logic here\n            return MyAjax.upload(file).then((response) =\u003e {\n              return {\n                success: 1,\n                file: {\n                  url: response.fileurl,\n                  // any data you want\n                  // for example: name, size, title\n                }\n              };\n            });\n          },\n        }\n      }\n    }\n  }\n  ...\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feditor-js%2Fattaches","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feditor-js%2Fattaches","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feditor-js%2Fattaches/lists"}