Skip to content

Commit 98f4305

Browse files
committed
Add mirror method
1 parent ccab11d commit 98f4305

11 files changed

Lines changed: 5310 additions & 3135 deletions

File tree

lib/clients/drive.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,23 @@ class RemoteHyperdrive {
171171
}))
172172
}
173173

174+
mirror (cb) {
175+
const req = new messages.MirrorRequest()
176+
177+
req.setId(this.id)
178+
179+
const unmirror = (cb) => {
180+
return this.unmirror(cb)
181+
}
182+
183+
return maybe(cb, new Promise((resolve, reject) => {
184+
this._client.mirror(req, toMetadata({ token: this.token }), (err, rsp) => {
185+
if (err) return reject(err)
186+
return resolve(unmirror)
187+
})
188+
}))
189+
}
190+
174191
download (path, opts, cb) {
175192
if (typeof opts === 'function') return this.download(path, null, opts)
176193
const req = new messages.DownloadRequest()

0 commit comments

Comments
 (0)