All files / src/fs-ambi write-file.js

83.33% Statements 5/6
75% Branches 3/4
100% Functions 3/3
80% Lines 4/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16        7x   7x 7x 7x              
import FS from 'fs'
 
 
export default function writeFile(path, string, options) {
	let { async, ...fsOpts } = options
 
	Eif (async)
		return new Promise(
			(resolve, reject) => FS.writeFile(path, string, fsOpts, (error) => error ? reject(error) : resolve())
		)
 
	else
		return FS.writeFileSync(path, string, fsOpts)
 
}