improve creation of Smartfiles
This commit is contained in:
parent
531f169c11
commit
97bf5ff74b
1
dist/smartfile.classes.smartfile.d.ts
vendored
1
dist/smartfile.classes.smartfile.d.ts
vendored
@ -3,6 +3,7 @@ export interface ISmartfileConstructorOptions {
|
|||||||
path?: string;
|
path?: string;
|
||||||
contentString?: string;
|
contentString?: string;
|
||||||
contentBuffer?: Buffer;
|
contentBuffer?: Buffer;
|
||||||
|
cwd?: string;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* class Smartfile
|
* class Smartfile
|
||||||
|
4
dist/smartfile.classes.smartfile.js
vendored
4
dist/smartfile.classes.smartfile.js
vendored
@ -23,12 +23,14 @@ class Smartfile {
|
|||||||
this.contents = optionsArg.contentBuffer;
|
this.contents = optionsArg.contentBuffer;
|
||||||
}
|
}
|
||||||
else if (optionsArg.contentString) {
|
else if (optionsArg.contentString) {
|
||||||
|
this.contentBuffer = optionsArg.contentBuffer;
|
||||||
this.contents = Buffer.from(optionsArg.contentString);
|
this.contents = Buffer.from(optionsArg.contentString);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('created empty Smartfile?');
|
console.log('created empty Smartfile?');
|
||||||
}
|
}
|
||||||
this.path = optionsArg.path;
|
this.path = optionsArg.path;
|
||||||
|
this.cwd = optionsArg.cwd;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* return relative path of file
|
* return relative path of file
|
||||||
@ -60,4 +62,4 @@ class Smartfile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Smartfile = Smartfile;
|
exports.Smartfile = Smartfile;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRmaWxlLmNsYXNzZXMuc21hcnRmaWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRmaWxlLmNsYXNzZXMuc21hcnRmaWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI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UFBcUI7UUFDekMsSUFBSSxDQUFDLFFBQVEsR0FBRyxJQUFJLE1BQU0sQ0FBQyxhQUFhLENBQUMsQ0FBQTtJQUMzQyxDQUFDO0lBRUQ7O09BRUc7SUFDRyxLQUFLOztRQUVYLENBQUM7S0FBQTtJQUVEOztPQUVHO0lBQ0csSUFBSTs7UUFDVixDQUFDO0tBQUE7Q0FDRjtBQXpFRCw4QkF5RUMifQ==
|
@ -4,6 +4,7 @@ export interface ISmartfileConstructorOptions {
|
|||||||
path?: string
|
path?: string
|
||||||
contentString?: string
|
contentString?: string
|
||||||
contentBuffer?: Buffer
|
contentBuffer?: Buffer
|
||||||
|
cwd?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,11 +46,13 @@ export class Smartfile {
|
|||||||
this.contentBuffer = optionsArg.contentBuffer
|
this.contentBuffer = optionsArg.contentBuffer
|
||||||
this.contents = optionsArg.contentBuffer
|
this.contents = optionsArg.contentBuffer
|
||||||
} else if (optionsArg.contentString) {
|
} else if (optionsArg.contentString) {
|
||||||
|
this.contentBuffer = optionsArg.contentBuffer
|
||||||
this.contents = Buffer.from(optionsArg.contentString)
|
this.contents = Buffer.from(optionsArg.contentString)
|
||||||
} else {
|
} else {
|
||||||
console.log('created empty Smartfile?')
|
console.log('created empty Smartfile?')
|
||||||
}
|
}
|
||||||
this.path = optionsArg.path
|
this.path = optionsArg.path
|
||||||
|
this.cwd = optionsArg.cwd
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user