2017-11-03 115 views
1

由于Google现在正在结束对Chrome应用程序的支持。最近邮递员不赞成他们的Chrome应用程序,并推出了一个本地应用程序。如何将邮递员历史记录从Chrome应用复制到本机应用?

我正在从postman chrome应用程序切换到本地应用程序。

如何将我的Chrome应用程序的历史记录复制到本机应用程序。同步不起作用。 有一个选项可以导出数据,但不会导出历史记录。

任何想法?

回答

2

所以,当我搜索这个,我遇到了this后,这是非常有益的。 感谢stephan分享此代码。 请按照以下步骤将您的历史记录从Chrome应用复制到本机应用。

//In Chrome DevTools on the background page of the Postman extension... 
 

 
//A handy helper method that lets you save data from the console to a file 
 
(function(console){ 
 

 
    console.save = function(data, filename){ 
 

 
     if(!data) { 
 
      console.error('Console.save: No data') 
 
      return; 
 
     } 
 

 
     if(!filename) filename = 'console.json' 
 

 
     if(typeof data === "object"){ 
 
      data = JSON.stringify(data, undefined, 4) 
 
     } 
 

 
     var blob = new Blob([data], {type: 'text/json'}), 
 
      e = document.createEvent('MouseEvents'), 
 
      a = document.createElement('a') 
 

 
     a.download = filename 
 
     a.href = window.URL.createObjectURL(blob) 
 
     a.dataset.downloadurl = ['text/json', a.download, a.href].join(':') 
 
     e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null) 
 
     a.dispatchEvent(e) 
 
    } 
 
})(console) 
 

 

 
var req = indexedDB.open('postman') 
 

 
//Wait for that to finish 
 

 
var db = req.result 
 
var r = db.transaction(["requests"],"readwrite").objectStore('requests').getAll() 
 

 
//Wait for that to finish 
 

 
//This will download a text file with your history 
 
console.save(JSON.stringify(r.result), 'postman-requests-export.json') 
 

 

 
//Switch to standalone app and open the dev console 
 

 
var req = indexedDB.open('postman') 
 

 
//Wait for that to finish 
 

 
var db = req.result 
 

 
var data = //Paste the text from the file exported above 
 

 
data.forEach(function(a){db.transaction(["requests"],"readwrite").objectStore('requests').add(a)}) 
 

 
//Restart Postman

注:

在Chrome应用中使用1.To你DevTools将需要启用以下标志
chrome://flagsflag

2.然后只需右键点击并检查你的Chrome邮递员应用程序。

3.在您的本地应用程序上的用户DevTools ctrl + shift + I(view-> showDevTools)

相关问题