UNPKG

@visulima/fs

Version:

Human friendly file system utilities for Node.js

69 lines (68 loc) 2.27 kB
/** * Modified functions from https://github.com/sindresorhus/move-file * * The original functions are licensed under the MIT License: * * MIT License * * Copyright (c) Sindre Sorhus &lt;sindresorhus@gmail.com> (https://sindresorhus.com) */ import type { Options } from './types.d.ts'; /** * Move a file asynchronously. * @param sourcePath The file you want to move. * @param destinationPath Where you want the file moved. * @param options Configuration options. * @returns A `Promise` that resolves when the file has been moved. * @example * ``` * import { move } from '@visulima/fs'; * * await move('source/test.png', 'destination/test.png'); * console.log('The file has been moved'); * ``` */ export declare const move: (sourcePath: string, destinationPath: string, options?: Options) => Promise<void>; /** * Move a file synchronously. * @param sourcePath The file you want to move. * @param destinationPath Where you want the file moved. * @param options Configuration options. * @example * ``` * import { moveSync } from '@visulima/fs'; * * moveSync('source/test.png', 'destination/test.png'); * console.log('The file has been moved'); * ``` */ export declare const moveSync: (sourcePath: string, destinationPath: string, options?: Options) => void; /** * Rename a file asynchronously. * @param source The file you want to rename. * @param destination The name of the renamed file. * @param options Configuration options. * @returns A `Promise` that resolves when the file has been renamed. * @example * ``` * import { rename } from '@visulima/fs'; * * await rename('test.png', 'tests.png', {cwd: 'source'}); * console.log('The file has been renamed'); * ``` */ export declare const rename: (source: string, destination: string, options?: Options) => Promise<void>; /** * Rename a file synchronously. * @param source The file you want to rename. * @param destination The name of the renamed file. * @param options Configuration options. * @example * ``` * import { renameSync } from '@visulima/fs'; * * renameSync('test.png', 'tests.png', {cwd: 'source'}); * console.log('The file has been renamed'); * ``` */ export declare const renameSync: (source: string, destination: string, options?: Options) => void;