INNER CODE UNIT · JavaScript
upgrade
opentimestamps/javascript-opentimestamps · ots-cli.js:343
function upgrade (argsFileOts, options) {
const otsPromise = Utils.readFilePromise(argsFileOts, null)
otsPromise.then(ots => {
let detachedOts
try {
detachedOts = DetachedTimestampFile.deserialize(ots)
} catch (err) {
if (err instanceof Context.BadMagicError) {
throw new Error('Error! ' + argsFileOts + ' is not a timestamp file.')
} else if (err instanceof Context.DeserializationError) {
throw new Error('Invalid timestamp file ' + argsFileOts)
} else {
throw err
}
}
const upgradePromise = OpenTimestamps.upgrade(detachedOts, options)
upgradePromise.then(changed => {