{"id":13546531,"url":"https://github.com/bobrik/node-aligned-buffer","last_synced_at":"2025-03-04T21:46:01.400Z","repository":{"id":4437494,"uuid":"5575737","full_name":"bobrik/node-aligned-buffer","owner":"bobrik","description":"Create aligned buffers to make faster disk io with less iops","archived":false,"fork":false,"pushed_at":"2012-10-16T04:27:00.000Z","size":108,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-04T13:48:13.542Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://bobrik.name","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bobrik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-27T19:14:54.000Z","updated_at":"2017-12-05T06:27:02.000Z","dependencies_parsed_at":"2022-08-27T07:20:21.516Z","dependency_job_id":null,"html_url":"https://github.com/bobrik/node-aligned-buffer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobrik%2Fnode-aligned-buffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobrik%2Fnode-aligned-buffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobrik%2Fnode-aligned-buffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobrik%2Fnode-aligned-buffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bobrik","download_url":"https://codeload.github.com/bobrik/node-aligned-buffer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241928533,"owners_count":20043821,"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-08-01T12:00:39.612Z","updated_at":"2025-03-04T21:46:01.352Z","avatar_url":"https://github.com/bobrik.png","language":"C++","readme":"# Aligned buffers for node.js\n\nAligned buffers will allow you to read data from disk much faster than you think you can.\nFor example, if you read 64k blocks from disk to aligned buffers, you may get 50% speed-up.\n\n## Installation\n\nInstall it as usual from npm:\n\n```\nnpm install aligned-buffer\n```\n\n## API\n\nRequire module:\n\n```javascript\nvar aligned = require(\"aligned-buffer\");\n```\n\nGetting alignment:\n\n```javascript\nvar alignment = aligned.alignment();\n```\n\nGetting aligned buffer:\n\n```javascript\nvar buf = aligned.buffer(/* alignment, don't change*/ aligned.alignment(), /* size */ 1024 * 64);\n```\n\n## Usage\n\nYou will need at least node-0.8.9 to support O_DIRECT flag.\nIf you want to use it with older node, you need to find out O_DIRECT\nvalue by yourself (`fgrep O_DIRECT /usr/include` for linux).\n\n```javascript\nvar fs        = require(\"fs\"),\n    aligned   = require(\"aligned-buffer\"),\n    constants = process.binding(\"constants\"),\n    fd        = fs.openSync(\"/my_big_file\", constants.O_RDONLY | constants.O_DIRECT),\n    size      = 64 * 1024, // 64k blocks\n    buf       = aligned.buffer(aligned.alignment(), size),\n    offset    = 0;\n\n// offset should be aligned to buf.length,\n// so allowed values are: 0, 64k, 128k, 172k\n// if offset is not aligned you will receive no boost\n\nfs.read(fd, buf, 0, buf.length, offset, function(error) {\n    if (error) {\n        console.log(error);\n        return;\n    }\n\n    console.log(\"successful read!\");\n});\n```\n\n## Authors\n\n* [Ian Babrou](https://github.com/bobrik)\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobrik%2Fnode-aligned-buffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbobrik%2Fnode-aligned-buffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobrik%2Fnode-aligned-buffer/lists"}