{"id":15022024,"url":"https://github.com/iam-medvedev/dosya","last_synced_at":"2025-07-03T13:35:50.745Z","repository":{"id":57698287,"uuid":"501389766","full_name":"iam-medvedev/dosya","owner":"iam-medvedev","description":"Module for creating buffer for the requested file type.","archived":false,"fork":false,"pushed_at":"2022-06-16T16:47:35.000Z","size":11,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T22:45:20.796Z","etag":null,"topics":["deno","nodejs","typescript"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/dosya","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iam-medvedev.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":"2022-06-08T19:47:01.000Z","updated_at":"2023-09-20T08:40:48.000Z","dependencies_parsed_at":"2022-08-25T11:11:49.007Z","dependency_job_id":null,"html_url":"https://github.com/iam-medvedev/dosya","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/iam-medvedev/dosya","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iam-medvedev%2Fdosya","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iam-medvedev%2Fdosya/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iam-medvedev%2Fdosya/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iam-medvedev%2Fdosya/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iam-medvedev","download_url":"https://codeload.github.com/iam-medvedev/dosya/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iam-medvedev%2Fdosya/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260793475,"owners_count":23064042,"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","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":["deno","nodejs","typescript"],"created_at":"2024-09-24T19:57:20.736Z","updated_at":"2025-07-03T13:35:50.707Z","avatar_url":"https://github.com/iam-medvedev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `dosya`\n\n`dosya` (Turkish) — file _n._\n\nModule for creating buffer for the requested file type.\n\nThis module is heavily inspired by [`file-type`](https://github.com/sindresorhus/file-type) and does the reverse work.\n\nFor example:\n\n```ts\nimport { createFile } from \"dosya\";\nimport { fileTypeFromBuffer } from \"file-type\";\n\nconst buffer = createFile(\"mp4\");\nconsole.log(await fileTypeFromBuffer(buffer));\n// =\u003e { ext: 'mp4', mime: 'video/mp4' }\n```\n\n## Benefits\n\n- 130 extensions are available\n- Written in Deno\n- Fully typed\n- Available for Deno / Node.js / CLI\n\n## Node.js Usage\n\n```bash\n$ yarn add -D dosya\n```\n\n```ts\nimport { createFile } from \"dosya\";\n\nconst buffer = createFile(\"mp4\");\n```\n\n## Deno Usage\n\n```ts\nimport { createFile } from \"https://deno.land/x/dosya/mod.ts\";\n\nconst buffer = createFile(\"mp4\");\n```\n\n## CLI Usage\n\n```bash\n$ deno install -n dosya --allow-write --allow-read https://deno.land/x/dosya/cli.ts\n$ dosya --ext mp3 ./example.mp3\n$ file ./example.mp3\nexample.mp3: Audio file with ID3 version 2.0.0\n```\n\n## Why?\n\nThis module is very useful for writing tests.\n\n```ts\nimport { createFile } from \"dosya\";\nimport nock from \"nock\";\nimport fetch from \"isomorphic-fetch\";\n\nnock(\"https://example.com\")\n  .get(\"/video.mp4\")\n  .replyWithFile(200, createFile(\"mp4\"));\n\nit(\"should get video from url\", async () =\u003e {\n  const buffer = await fetch(\"https://example.com/video.mp4\").then((res) =\u003e\n    res.arrayBuffer()\n  );\n\n  const fileType = await fileTypeFromBuffer(buffer);\n  expect(fileType.ext).toEqual(\"mp4\"); // true\n});\n```\n\n## License\n\n`dosya` is [WTFPL licensed](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiam-medvedev%2Fdosya","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiam-medvedev%2Fdosya","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiam-medvedev%2Fdosya/lists"}