javascript - Google Chrome extension - download, move and delete files -
javascript - Google Chrome extension - download, move and delete files -
i trying o create app work (will used in office) , among other things need way download file (it 1 odt , 1 txt document initiated clicking on button user, on specific page - standard download) our local server. 2 files created on server , sent download user requested it, part simple other web page offers download.
but after download finished need somehow:
1) automatically open odt (openoffice writer) file, user can go on editing it. happen next not important...
2) automatically move txt file specific folder on users disk (this needed because specific folder monitored our special printer , whenever printer detects file in folder automatically starts printing). setting default chrome download folder monitored folder not options - need move txt file automatically after download monitored folder.
3) after first 2 actions finished need clean default download folder (foldere chrome downloads default) because total of files , not needed anymore.
now, great if accomplish javascript know there no way manipulate files on local scheme without displaying dialog user - not option.
i figure out part done chrome extension, acceptable solution because application used in office. not sure how , if possible accomplish want need help.
p.s. of import after user click "download" on page download odt , txt file, there no other windows, dialog , other "questions" browser after should go automatically.
thank you!
yes, can tasks chrome.downloads api, long can take subfolder of downloads folder target printer. cannot download in arbitrary folder, i'm afraid.
after download initiated chrome.downloads.download finishes, can initiate opening chrome.downloads.open(downloadid).
you can initiate download subfolder supplying relative path chrome.downloads.download (note / slash instead of \): printout/file.txt.
you can remember download id's , clean afterwards chrome.downloads.removefile(downloadid).
please take note of permissions need add, quite fine-grained api.
javascript google-chrome google-chrome-extension
Comments
Post a Comment