{"id":15679498,"url":"https://github.com/linusu/buffer-alloc","last_synced_at":"2025-04-15T21:17:32.433Z","repository":{"id":57190940,"uuid":"66022393","full_name":"LinusU/buffer-alloc","owner":"LinusU","description":"A ponyfill for Buffer.alloc","archived":false,"fork":false,"pushed_at":"2018-11-20T13:26:48.000Z","size":14,"stargazers_count":13,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T21:17:27.140Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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-18T18:47:26.000Z","updated_at":"2025-03-02T11:43:01.000Z","dependencies_parsed_at":"2022-09-15T22:21:47.173Z","dependency_job_id":null,"html_url":"https://github.com/LinusU/buffer-alloc","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fbuffer-alloc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fbuffer-alloc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fbuffer-alloc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinusU%2Fbuffer-alloc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LinusU","download_url":"https://codeload.github.com/LinusU/buffer-alloc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249153953,"owners_count":21221330,"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-03T16:32:04.798Z","updated_at":"2025-04-15T21:17:32.406Z","avatar_url":"https://github.com/LinusU.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Buffer Alloc\n\nA [ponyfill](https://ponyfill.com) for `Buffer.alloc`.\n\nWorks as Node.js: `v7.0.0` \u003cbr\u003e\nWorks on Node.js: `v0.10.0`\n\n## Installation\n\n```sh\nnpm install --save buffer-alloc\n```\n\n## Usage\n\n```js\nconst alloc = require('buffer-alloc')\n\nconsole.log(alloc(4))\n//=\u003e \u003cBuffer 00 00 00 00\u003e\n\nconsole.log(alloc(6, 0x41))\n//=\u003e \u003cBuffer 41 41 41 41 41 41\u003e\n\nconsole.log(alloc(10, 'linus', 'utf8'))\n//=\u003e \u003cBuffer 6c 69 6e 75 73 6c 69 6e 75 73\u003e\n```\n\n## API\n\n### alloc(size[, fill[, encoding]])\n\n- `size` \u0026lt;Integer\u0026gt; The desired length of the new `Buffer`\n- `fill` \u0026lt;String\u0026gt; | \u0026lt;Buffer\u0026gt; | \u0026lt;Integer\u0026gt; A value to pre-fill the new `Buffer` with. **Default:** `0`\n- `encoding` \u0026lt;String\u0026gt; If `fill` is a string, this is its encoding. **Default:** `'utf8'`\n\nAllocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the `Buffer` will be zero-filled.\n\n## See also\n\n- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe`\n- [buffer-fill](https://github.com/LinusU/buffer-fill) A ponyfill for `Buffer.fill`\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-alloc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinusu%2Fbuffer-alloc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinusu%2Fbuffer-alloc/lists"}