{"id":15684146,"url":"https://github.com/linusu/buffer-fill","last_synced_at":"2025-04-28T16:12:08.719Z","repository":{"id":57190963,"uuid":"66058137","full_name":"LinusU/buffer-fill","owner":"LinusU","description":"A ponyfill for Buffer.fill","archived":false,"fork":false,"pushed_at":"2018-11-20T13:25:59.000Z","size":12,"stargazers_count":10,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-28T16:12:00.958Z","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/LinusU.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":"2016-08-19T06:23:07.000Z","updated_at":"2024-05-10T02:31:25.000Z","dependencies_parsed_at":"2022-09-15T22:21:45.627Z","dependency_job_id":null,"html_url":"https://github.com/LinusU/buffer-fill","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fbuffer-fill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fbuffer-fill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fbuffer-fill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fbuffer-fill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LinusU","download_url":"https://codeload.github.com/LinusU/buffer-fill/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251342725,"owners_count":21574245,"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":[],"created_at":"2024-10-03T17:11:40.396Z","updated_at":"2025-04-28T16:12:08.683Z","avatar_url":"https://github.com/LinusU.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Buffer Fill\n\nA [ponyfill](https://ponyfill.com) for `Buffer.fill`.\n\nWorks as Node.js: `v6.4.0` \u003cbr\u003e\nWorks on Node.js: `v0.10.0`\n\n## Installation\n\n```sh\nnpm install --save buffer-fill\n```\n\n## Usage\n\n```js\nconst fill = require('buffer-fill')\nconst buf = Buffer.allocUnsafe(5)\n\nconsole.log(buf.fill(8))\n//=\u003e \u003cBuffer 08 08 08 08 08\u003e\n\nconsole.log(buf.fill(9, 2, 4))\n//=\u003e \u003cBuffer 08 08 09 09 08\u003e\n\nconsole.log(buf.fill('linus', 'latin1'))\n//=\u003e \u003cBuffer 6c 69 6e 75 73\u003e\n\nconsole.log(buf.fill('\\u0222'))\n//=\u003e \u003cBuffer c8 a2 c8 a2 c8\u003e\n```\n\n## API\n\n### fill(buf, value[, offset[, end]][, encoding])\n\n- `value` \u0026lt;String\u0026gt; | \u0026lt;Buffer\u0026gt; | \u0026lt;Integer\u0026gt; The value to fill `buf` with\n- `offset` \u0026lt;Integer\u0026gt; Where to start filling `buf`. **Default:** `0`\n- `end` \u0026lt;Integer\u0026gt; Where to stop filling `buf` (not inclusive). **Default:** `buf.length`\n- `encoding` \u0026lt;String\u0026gt; If `value` is a string, this is its encoding. **Default:** `'utf8'`\n- Return: \u0026lt;Buffer\u0026gt; A reference to `buf`\n\nFills `buf` with the specified `value`. If the `offset` and `end` are not given,\nthe entire `buf` will be filled. This is meant to be a small simplification to\nallow the creation and filling of a `Buffer` to be done on a single line.\n\nIf the final write of a `fill()` operation falls on a multi-byte character, then\nonly the first bytes of that character that fit into `buf` are written.\n\n## See also\n\n- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe`\n- [buffer-alloc](https://github.com/LinusU/buffer-alloc) A ponyfill for `Buffer.alloc`\n- [buffer-from](https://github.com/LinusU/buffer-from) A ponyfill for `Buffer.from`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinusu%2Fbuffer-fill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinusu%2Fbuffer-fill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinusu%2Fbuffer-fill/lists"}