implement Smartfile.write
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
import * as plugins from './smartfile.plugins'
|
||||
import * as fs from './smartfile.fs'
|
||||
import * as memory from './smartfile.memory'
|
||||
|
||||
export interface ISmartfileConstructorOptions {
|
||||
path?: string
|
||||
@ -68,9 +70,12 @@ export class Smartfile {
|
||||
|
||||
/**
|
||||
* write file to disk
|
||||
* Behaviours:
|
||||
* - no argument write to exactly where the file was picked up
|
||||
*/
|
||||
async write () {
|
||||
|
||||
async write (pathArg?: string) {
|
||||
const stringToWrite = this.contentBuffer.toString()
|
||||
await memory.toFs(stringToWrite, this.path)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'typings-global'
|
||||
export import fs = require('fs')
|
||||
export import fsExtra = require('fs-extra')
|
||||
export let glob = require('glob')
|
||||
|
@ -42,7 +42,6 @@ export let toString = (fromArg: string) => {
|
||||
if (res.statusCode === 200) {
|
||||
done.resolve(res.body)
|
||||
} else {
|
||||
console.error('could not get remote file from ' + fromArg)
|
||||
done.reject(new Error('could not get remote file from ' + fromArg))
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user