chore(vhd-merge): Vhd#_writeStream()
This commit is contained in:
@@ -357,13 +357,17 @@ class Vhd {
|
|||||||
// Write functions.
|
// Write functions.
|
||||||
// =================================================================
|
// =================================================================
|
||||||
|
|
||||||
|
_writeStream (start) {
|
||||||
|
return this._handler.createOutputStream(this._path, {
|
||||||
|
flags: 'r+',
|
||||||
|
start
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Write a buffer at a given position in a vhd file.
|
// Write a buffer at a given position in a vhd file.
|
||||||
async _write (buffer, offset) {
|
async _write (buffer, offset) {
|
||||||
// TODO: could probably be merged in remote handlers.
|
// TODO: could probably be merged in remote handlers.
|
||||||
return this._handler.createOutputStream(this._path, {
|
return this._writeStream(offset).then(stream => new Promise((resolve, reject) => {
|
||||||
start: offset,
|
|
||||||
flags: 'r+'
|
|
||||||
}).then(stream => new Promise((resolve, reject) => {
|
|
||||||
stream.on('error', reject)
|
stream.on('error', reject)
|
||||||
stream.write(buffer, () => {
|
stream.write(buffer, () => {
|
||||||
stream.end()
|
stream.end()
|
||||||
|
|||||||
Reference in New Issue
Block a user