UNPKG

gitly

Version:

An API to download and/or extract git repositories

16 lines (15 loc) 523 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = write; const node_fs_1 = require("node:fs"); const node_path_1 = require("node:path"); const { mkdir } = node_fs_1.promises; /** * Create a folder and return a writable stream. * @param path The path to write a file */ async function write(path) { const _path = (0, node_path_1.normalize)(path); await mkdir((0, node_path_1.dirname)(_path), { recursive: true }); return (0, node_fs_1.createWriteStream)(_path); }