Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wrote/ensure-path

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wrote/ensure-path

Create all directories on the way to the path.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
76
increased by8.57%
Maintainers
1
Weekly downloads
 
Created
Source

@wrote/ensure-path

npm version

@wrote/ensure-path Creates All Directories On The Way To The Path.

yarn add @wrote/ensure-path

Table Of Contents

API

The package is available by importing its default and named function:

import ensurePath, { ensurePathSync } from '@wrote/ensure-path'

async ensurePath(
  path: string,
): string

Makes sure that the path can be written to by recursively creating all necessary directories. Returns the same path as passed to the function.

import { resolve } from 'path'
import ensurePath from '@wrote/ensure-path'

(async () => {
  const path = 'example/path/to/temp/file.data'
  await ensurePath(path)
  // path/to/temp is created in the cwd

  const absolutePath = resolve('example/path/to/temp/file.data')
  await ensurePath(absolutePath)
  // $(pwd)/path/to/temp/file.data is created
})()

ensurePathSync(
  path: string,
): string

Same as ensurePath, but performed synchronously.

import { resolve } from 'path'
import { ensurePathSync } from '@wrote/ensure-path'

const path = 'example/path/to/temp/file.data'
ensurePathSync(path)
// path/to/temp is created in the cwd

const absolutePath = resolve('example/path/to/temp/file.data')
ensurePathSync(absolutePath)
// $(pwd)/path/to/temp/file.data is created

Art Deco © Art Deco for Wrote 2019 Wrote Tech Nation Visa Tech Nation Visa Sucks

Keywords

FAQs

Package last updated on 03 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc