Skip to content

Instantly share code, notes, and snippets.

View niekoost's full-sized avatar

Niek Oost niekoost

View GitHub Profile
@niekoost
niekoost / firebase_copy.js
Last active August 19, 2017 18:27 — forked from jofftiquez/firebase_copy.js
Move or copy a Firebase path to a new location - Promise
function copyFbRecord(oldRef, newRef) {
return Promise((resolve, reject) => {
oldRef.once('value').then(snap => {
return newRef.set(snap.val());
}).then(() => {
console.log('Done!');
resolve();
}).catch(err => {
console.log(err.message);
reject();