{"id":18523679,"url":"https://github.com/sonicdoe/detect-newline-at-eof","last_synced_at":"2026-04-02T02:36:40.676Z","repository":{"id":66035258,"uuid":"39295896","full_name":"sonicdoe/detect-newline-at-eof","owner":"sonicdoe","description":"Detect newline at end of file","archived":false,"fork":false,"pushed_at":"2020-07-20T15:46:05.000Z","size":197,"stargazers_count":3,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-04-20T00:45:47.770Z","etag":null,"topics":["detect","eof","javascript","newline","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sonicdoe.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-07-18T11:17:31.000Z","updated_at":"2023-05-23T13:29:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"f3004b31-030e-49a9-a171-1efd1e6a0917","html_url":"https://github.com/sonicdoe/detect-newline-at-eof","commit_stats":{"total_commits":37,"total_committers":2,"mean_commits":18.5,"dds":"0.43243243243243246","last_synced_commit":"484fdb4252c1b59b157e696409bc6b125805e770"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonicdoe%2Fdetect-newline-at-eof","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonicdoe%2Fdetect-newline-at-eof/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonicdoe%2Fdetect-newline-at-eof/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonicdoe%2Fdetect-newline-at-eof/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sonicdoe","download_url":"https://codeload.github.com/sonicdoe/detect-newline-at-eof/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254209859,"owners_count":22032897,"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":["detect","eof","javascript","newline","nodejs"],"created_at":"2024-11-06T17:37:06.904Z","updated_at":"2026-04-02T02:36:40.647Z","avatar_url":"https://github.com/sonicdoe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# detect-newline-at-eof\n\n[![Node.js package](https://img.shields.io/npm/v/detect-newline-at-eof.svg)](https://www.npmjs.com/package/detect-newline-at-eof)\n[![Linux Build Status](https://img.shields.io/travis/sonicdoe/detect-newline-at-eof/develop.svg)](https://travis-ci.org/sonicdoe/detect-newline-at-eof)\n[![Windows Build Status](https://img.shields.io/appveyor/ci/sonicdoe/detect-newline-at-eof/develop.svg)](https://ci.appveyor.com/project/sonicdoe/detect-newline-at-eof)\n\n\u003e Detect newline at end of file\n\ndetect-newline-at-eof is similar to [trailing-newline](https://github.com/bendrucker/trailing-newline) but will also match `\\n` on Windows and `\\r\\n` on macOS.\n\n## Installation\n\n```console\n$ npm install detect-newline-at-eof\n```\n\n## Usage\n\n```js\nconst fs = require('fs')\nconst detectNewlineAtEof = require('detect-newline-at-eof')\n\nconst fileContents = fs.readFileSync('file.txt', 'utf8')\nconst newlineCharacter = detectNewlineAtEof(fileContents)\n\nconsole.log(newlineCharacter)\n// =\u003e \\n, \\r\\n, or null if no newline character at the end was found\n```\n\n## Changelog\n\nThis project follows [Semantic Versioning 2](https://semver.org).\n\n- v1.0.0 (2018-07-20):\n  - Add support for Node.js v6, v8, and v10\n  - Drop support for Node.js versions older than v6\n  - Drop support for io.js\n- v0.1.0 (2015-07-18): Initial release.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonicdoe%2Fdetect-newline-at-eof","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsonicdoe%2Fdetect-newline-at-eof","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonicdoe%2Fdetect-newline-at-eof/lists"}