{"id":13541042,"url":"https://github.com/random-access-storage/random-access-file","last_synced_at":"2026-01-12T14:41:29.100Z","repository":{"id":9445499,"uuid":"11323043","full_name":"random-access-storage/random-access-file","owner":"random-access-storage","description":"Continuous reading or writing to a file using random offsets and lengths","archived":false,"fork":false,"pushed_at":"2024-12-20T09:10:18.000Z","size":84,"stargazers_count":154,"open_issues_count":2,"forks_count":25,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-25T08:18:17.009Z","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":"librenms/librenms","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/random-access-storage.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-07-10T20:13:08.000Z","updated_at":"2025-01-20T07:49:56.000Z","dependencies_parsed_at":"2022-08-03T00:30:29.317Z","dependency_job_id":"c625a2e1-96dd-4e95-a3f5-a2b72fae06ca","html_url":"https://github.com/random-access-storage/random-access-file","commit_stats":{"total_commits":124,"total_committers":9,"mean_commits":"13.777777777777779","dds":"0.15322580645161288","last_synced_commit":"cf9e9576c08f0185c51fa8f15f01d415cb557ef7"},"previous_names":["mafintosh/random-access-file"],"tags_count":44,"template":false,"template_full_name":null,"purl":"pkg:github/random-access-storage/random-access-file","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/random-access-storage%2Frandom-access-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/random-access-storage%2Frandom-access-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/random-access-storage%2Frandom-access-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/random-access-storage%2Frandom-access-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/random-access-storage","download_url":"https://codeload.github.com/random-access-storage/random-access-file/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/random-access-storage%2Frandom-access-file/sbom","scorecard":{"id":761350,"data":{"date":"2025-08-11","repo":{"name":"github.com/random-access-storage/random-access-file","commit":"f2ea5a81051483844997e236b3171502d9d96c35"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Code-Review","score":2,"reason":"Found 8/30 approved changesets -- score normalized to 2","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":"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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test-node.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":"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":"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/test-node.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/random-access-storage/random-access-file/test-node.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-node.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/random-access-storage/random-access-file/test-node.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/test-node.yml:23","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand 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":"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":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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":"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 10 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"}}]},"last_synced_at":"2025-08-22T23:34:48.567Z","repository_id":9445499,"created_at":"2025-08-22T23:34:48.567Z","updated_at":"2025-08-22T23:34:48.567Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28340403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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-01T10:00:37.765Z","updated_at":"2026-01-12T14:41:29.078Z","avatar_url":"https://github.com/random-access-storage.png","language":"JavaScript","funding_links":[],"categories":["Dat Core Modules"],"sub_categories":["Storage"],"readme":"# random-access-file\n\nContinuous reading or writing to a file using random offsets and lengths\n\n```\nnpm install random-access-file\n```\n\n## Why?\n\nIf you are receiving a file in multiple pieces in a distributed system it can be useful to write these pieces to disk one by one in various places throughout the file without having to open and close a file descriptor all the time.\n\nrandom-access-file allows you to do just this.\n\n## Usage\n\n``` js\nconst RandomAccessFile = require('random-access-file')\n\nconst file = new RandomAccessFile('my-file.txt')\n\nfile.write(10, Buffer.from('hello'), function(err) {\n  // write a buffer to offset 10\n  file.read(10, 5, function(err, buffer) {\n    console.log(buffer) // read 5 bytes from offset 10\n    file.close(function() {\n      console.log('file is closed')\n    })\n  })\n})\n```\n\nfile will use an open file descriptor. When you are done with the file you should call `file.close()`.\n\n## API\n\n#### `const file = new RandomAccessFile(filename, [options])`\n\nCreate a new file. Options include:\n\n``` js\n{\n  truncate: false, // truncate the file before reading / writing\n  size: someSize, // truncate the file to this size first\n  readable: true, // should the file be opened as readable?\n  writable: true,  // should the file be opened as writable?\n  lock: false, // lock the file\n  sparse: false // mark the file as sparse\n}\n```\n\n#### `file.write(offset, buffer, [callback])`\n\nWrite a buffer at a specific offset.\n\n#### `file.read(offset, length, callback)`\n\nRead a buffer at a specific offset. Callback is called with the buffer read.\n\n#### `file.del(offset, length, callback)`\n\nDelete a portion of the file. Any partial file blocks in the deleted portion are zeroed and, if the file is sparse, the remaining file blocks unlinked in-place.\n\n#### `file.truncate(offset, callback)`\n\nTruncate the file length to this offset.\n\n#### `file.stat(callback)`\n\nStat the storage. Should return an object with useful information about the underlying storage, including:\n\n```js\n{\n  size: number // how many bytes of data is stored?\n}\n```\n\n#### `file.close([callback])`\n\nClose the underlying file descriptor.\n\n#### `file.unlink([callback])`\n\nUnlink the underlying file.\n\n#### `file.on('open')`\n\nEmitted when the file descriptor has been opened. You can access the fd using `file.fd`.\nYou do not need to wait for this event before doing any reads/writes.\n\n#### `file.on('close')`\n\nEmitted when the file has been closed.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandom-access-storage%2Frandom-access-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frandom-access-storage%2Frandom-access-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandom-access-storage%2Frandom-access-file/lists"}