123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #!/usr/bin/coffee
- 'use strict'
- PouchDB = require 'pouchdb'
- path = require('path')
- globalThis.pass = ()=>([1e4]+'').replace(/[018]/g,c=()->(c^crypto.getRandomValues(new Uint8Array(1))[0]&15 >> c/4).toString(16))
- globalThis.md5 = require 'md5'
- basePatch = 'https://oleg:631074@couchdb.osvoj.ru:443/000SitesScript/'
- db = new PouchDB(basePatch, {auto_compaction: true});
- c= []
- #84832606810
- test = ()->
- #console.dir c
- if c.length > 0
- a = c.shift()
- console.log '============ start ============'
- console.dir a
- db.get a.id, { open_revs:"all", attachments: true }
- .then (d)->
- console.dir d
- #path.exists 'backUp/'+a.id+'.json', (exists)->
- # if exists
- # dr = require 'backUp/'+a.id+'.json'
- # if d._rev != dr.ok._rev
- # else
- fs.writeFile './base/'+a.id+'.json', JSON.stringify(d), 'utf8', (a)->
- console.dir a
- test()
- fs = require('fs')
- upl = ()->
- db.allDocs()
- .then (d)->
- c = d.rows
- test()
- fs.writeFile '../base.json', JSON.stringify(d), 'utf8', (a)->
- console.dir a
- upl()
|