{"id":18763572,"url":"https://github.com/iguntur/path-ensure","last_synced_at":"2025-04-13T04:32:42.812Z","repository":{"id":57320654,"uuid":"105073579","full_name":"iguntur/path-ensure","owner":"iguntur","description":":rocket: Ensure path exists","archived":false,"fork":false,"pushed_at":"2018-12-03T10:07:35.000Z","size":10,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T21:45:54.493Z","etag":null,"topics":["async","await","ensure","extra","fs","make-dir","micro","mkdir","mkdirp","path","sync","tiny","writefile"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/iguntur.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":"2017-09-27T21:58:06.000Z","updated_at":"2019-04-19T16:52:05.000Z","dependencies_parsed_at":"2022-08-26T01:11:02.336Z","dependency_job_id":null,"html_url":"https://github.com/iguntur/path-ensure","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/iguntur%2Fpath-ensure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iguntur%2Fpath-ensure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iguntur%2Fpath-ensure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iguntur%2Fpath-ensure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iguntur","download_url":"https://codeload.github.com/iguntur/path-ensure/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248664139,"owners_count":21141906,"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":["async","await","ensure","extra","fs","make-dir","micro","mkdir","mkdirp","path","sync","tiny","writefile"],"created_at":"2024-11-07T18:26:39.218Z","updated_at":"2025-04-13T04:32:42.555Z","avatar_url":"https://github.com/iguntur.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# path-ensure\n\n[![Build Status](https://img.shields.io/travis/iguntur/path-ensure.svg?style=flat-square)](https://travis-ci.org/iguntur/path-ensure)\n[![node](https://img.shields.io/node/v/path-ensure.svg?style=flat-square)](#)\n[![npm](https://img.shields.io/npm/v/path-ensure.svg?style=flat-square)](https://www.npmjs.org/package/path-ensure)\n\n\u003e Ensure path exists\n\n---\n\nA simple module to generate the directory before writing the files. See [`fs-extra`](https://github.com/jprichardson/node-fs-extra) for advance.\n\n\n## Install\n\n```\n$ npm install path-ensure\n```\n\n## API\n\n### pathEnsure([...paths])\n\n- Params:\n    - paths: `\u003cstring[]\u003e` - A sequence of path segments.\n- Return: `\u003cPromise\u003cstring\u003e\u003e`\n- Example:\n    ```js\n    const fs = require('fs');\n    const pathEnsure = require('path-ensure');\n\n    (async () =\u003e {\n        const filepath = await pathEnsure(__dirname, 'some/path/to/create', 'unicorn.txt');\n        console.log(filepath);\n        const writeStream = fs.createWriteStream(filepath);\n        writeStream.write('🦄');\n    })();\n    ```\n\n#### .sync([...paths])\n\n- Params:\n    - paths: `\u003cstring[]\u003e` - A sequence of path segments.\n- Return: `\u003cstring\u003e`\n- Example:\n    ```js\n    const fs = require('fs');\n    const pathEnsure = require('path-ensure');\n    const writeStream = fs.createWriteStream(\n        pathEnsure.sync('some/path/to/create', 'unicorn.txt')\n    );\n    writeStream.write('🦄');\n    ```\n\n\n## Related\n\n- [make-dir](https://github.com/sindresorhus/make-dir) - Make a directory and its parents if needed - Think `mkdir -p`\n- [fs-extra](https://github.com/jprichardson/node-fs-extra) - Contains methods that aren't included in the vanilla Node.js fs package.\n\n\n## License\n\nMIT © [Guntur Poetra](http://github.com/iguntur)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figuntur%2Fpath-ensure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figuntur%2Fpath-ensure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figuntur%2Fpath-ensure/lists"}