Comparing version 6.1.0 to 6.2.0
123
index.d.ts
@@ -1,67 +0,78 @@ | ||
export interface Options { | ||
/** | ||
* Overwrite existing file. | ||
* | ||
* @default true | ||
*/ | ||
readonly overwrite?: boolean; | ||
declare namespace cpFile { | ||
interface Options { | ||
/** | ||
Overwrite existing file. | ||
@default true | ||
*/ | ||
readonly overwrite?: boolean; | ||
} | ||
interface ProgressData { | ||
/** | ||
Absolute path to source. | ||
*/ | ||
src: string; | ||
/** | ||
Absolute path to destination. | ||
*/ | ||
dest: string; | ||
/** | ||
File size in bytes. | ||
*/ | ||
size: number; | ||
/** | ||
Copied size in bytes. | ||
*/ | ||
written: number; | ||
/** | ||
Copied percentage, a value between `0` and `1`. | ||
*/ | ||
percent: number; | ||
} | ||
interface ProgressEmitter { | ||
/** | ||
For empty files, the `progress` event is emitted only once. | ||
*/ | ||
on(event: 'progress', handler: (data: ProgressData) => void): Promise<void>; | ||
} | ||
} | ||
export interface ProgressData { | ||
declare const cpFile: { | ||
/** | ||
* Absolute path to source. | ||
*/ | ||
src: string; | ||
Copy a file. | ||
/** | ||
* Absolute path to destination. | ||
*/ | ||
dest: string; | ||
@param source - File you want to copy. | ||
@param destination - Where you want the file copied. | ||
@returns A `Promise` that resolves when the file is copied. | ||
/** | ||
* File size in bytes. | ||
*/ | ||
size: number; | ||
@example | ||
``` | ||
import cpFile = require('cp-file'); | ||
/** | ||
* Copied size in bytes. | ||
*/ | ||
written: number; | ||
(async () => { | ||
await cpFile('source/unicorn.png', 'destination/unicorn.png'); | ||
console.log('File copied'); | ||
})(); | ||
``` | ||
*/ | ||
(source: string, destination: string, options?: cpFile.Options): Promise<void> & cpFile.ProgressEmitter; | ||
/** | ||
* Copied percentage, a value between `0` and `1`. | ||
*/ | ||
percent: number; | ||
} | ||
Copy a file synchronously. | ||
export interface ProgressEmitter { | ||
/** | ||
* For empty files, the `progress` event is emitted only once. | ||
*/ | ||
on(event: 'progress', handler: (data: ProgressData) => void): Promise<void>; | ||
} | ||
@param source - File you want to copy. | ||
@param destination - Where you want the file copied. | ||
*/ | ||
sync(source: string, destination: string, options?: cpFile.Options): void; | ||
/** | ||
* Copy a file. | ||
* | ||
* @param source - File you want to copy. | ||
* @param destination - Where you want the file copied. | ||
* @returns A `Promise` that resolves when the file is copied. | ||
*/ | ||
export default function cpFile( | ||
source: string, | ||
destination: string, | ||
options?: Options | ||
): Promise<void> & ProgressEmitter; | ||
// TODO: Remove this for the next major release | ||
default: typeof cpFile; | ||
}; | ||
/** | ||
* Copy a file synchronously. | ||
* | ||
* @param source - File you want to copy. | ||
* @param destination - Where you want the file copied. | ||
*/ | ||
export function sync( | ||
source: string, | ||
destination: string, | ||
options?: Options | ||
): void; | ||
export = cpFile; |
@@ -67,2 +67,3 @@ 'use strict'; | ||
module.exports = cpFile; | ||
// TODO: Remove this for the next major release | ||
module.exports.default = cpFile; | ||
@@ -69,0 +70,0 @@ |
{ | ||
"name": "cp-file", | ||
"version": "6.1.0", | ||
"version": "6.2.0", | ||
"description": "Copy a file", | ||
@@ -23,3 +23,3 @@ "license": "MIT", | ||
"scripts": { | ||
"test": "xo && nyc ava && tsd-check" | ||
"test": "xo && nyc ava && tsd" | ||
}, | ||
@@ -56,13 +56,13 @@ "files": [ | ||
"devDependencies": { | ||
"ava": "^1.2.1", | ||
"ava": "^1.4.1", | ||
"clear-module": "^3.1.0", | ||
"coveralls": "^3.0.0", | ||
"del": "^4.0.0", | ||
"coveralls": "^3.0.3", | ||
"del": "^4.1.0", | ||
"import-fresh": "^3.0.0", | ||
"nyc": "^13.3.0", | ||
"sinon": "^7.2.6", | ||
"tsd-check": "^0.3.0", | ||
"uuid": "^3.0.0", | ||
"sinon": "^7.3.1", | ||
"tsd": "^0.7.2", | ||
"uuid": "^3.3.2", | ||
"xo": "^0.24.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15237
352