I’m making a simple web browser for work eeh, what I’d like to know is if its possible to save a file of a particular extension to a particular file.
I currently use google chrome when downloading a file it places this (regardless of extension) in a downloads folder without asking where I ant to download this too.
I want to achieve the same except that downloads with the extension .dwg are placed automatically in a folder named DWG DOWNLOADS…
How to achieve this in vb.net?
In any browser you have a config section.
In Firefox you have browser.download.useDownloadDir;true and browser.download.folderList;1
you can add your own config to allow different saved folder paths and dynamically modify them depending on the extension of the file you uploaded.
See a complete list of the web browser config with about:config in address bar.
Not real sure what you are asking, but if you are actually making a web browser just check the extension of the file you are requesting to download. If the extension is ".dwg" then save the file to the folder you want.
If you are wanting to automatically move Google Chrome downloads to a different directory, you can use a FileSystemWatcher to monitor for new files in Chrome's download directory and move them to another folder based on each file's extension.
Related
I am using scrapy to scrape a website and I can download the file from the page, however everything that is being download is a plain text file. How do I download it with it's extension type? I am downloading scripts and as such, having the proper extension type on my download is necessary.
For example, if I am downloading exploits from exploit-db, the link that I go to to download them would be for example: https://www.exploit-db.com/exploits/19832/
and the link i would extract from there to download from is https://www.exploit-db.com/download/19832 which will, if I click on it normally, download a ruby file. But through scrapy it gets saved as a text file. Is there a way to download it as a .rb through scrapy?
Just save it as filename.rb. All files are text/binary files. Extension is there just to tell your operating system what to use to understand that file.
(In some operating systems extension isn't even required since files have headers at the beginning of the file telling what they are)
You can do try this:
scrapy shell https://www.exploit-db.com/download/19832
Then in the shell or your spider just do:
with open('ruby_file.rb', 'wb') as ruby_file:
ruby_file.write(response.body)
I have a very particular case and I don't know if this is possible to be done.
I'm using NWJS to run a web app as a desktop app. I need to zip/package the source files because my code should not be available to eavesdroppers. This package will be delivered on a flash drive. And this is were my trouble begins.
There are a lot of .pdf file that must be shipped together with the package. The user can browse which pdf he wants to open, and when he clicks it, the pdf is "downloaded" to his pc. The content of the pdf is NOT available on the application. I have a list with the name of each pdf file.
If I zip/package the .pdf together with the source files it becomes a huge .nw file and it takes forever for my application to load. I need to mantain the pdf on a separate folder and they need to be accessible through the source code. This is easy if i run the application directly without packaging it, as nw uses the relative url to it's root, but when I do package nw uses a temp folder for the source files and I can't use relative url to access the pdf folder.
The only approach i can think of is to write a js script to identify where the flash drive was mounted but i don't know if this is possible.
I have to support Windows and Mac for this case.
Searching on NWJS google group i found that the answer was quite simple. These two lines returns the path where the nw bin is running. From there is quite simple to get the pdf folder.
var path = require("path");
pathstr = path.dirname(process.execPath);
I am trying to use WinSCP to access a remote HTML file, and I do have root permission. However, if I open that HTML, it seems that all the sources and scripts are dysfunctional, e.g no images, buttons etc are loaded, and no js functions work. So how can I open a HTML using WinSCP so that all the sources are loaded and work properly? Thanks a lot.
I assume you "Open" the HTML file from a remote panel of WinSCP.
This makes WinSCP download the file to a temporary local folder and open the file from there.
As all the references to images and java script files are typically relative paths, they won't work from the temporary folder as the referenced files are not there. So it cannot work.
Either you need to download all files (including images and .js) to a local folder and open the HTML there.
Or you actually want to open the file from the server, via HTTP.
For that use the WinSCP extension "Generate HTTP URL".
I am uploading my first Opera Extension. It is very simple. It is a toolbar button that launches a popup window. It works perfectly fine in Opera developer mode. Opera is not letting me upload it successfully. It keeps saying the persona.ini file is missing. Meanwhile I downloaded quite a few extensions already live in the Opera Extensions Directory to see their persona.ini files and none of them even have a persona.ini file. I can only find one example of a persona.ini file online and it must not be correct because it doesn't allow the upload either.
Has anyone experienced this? Why is this happening?
You're probably uploading the extension in .zip format, which is not supported — only .crx and .nex are supported. .zip is only used for Opera themes (hence the reference to persona.ini).
So, to fix this, you can do the following: when in developer mode, use the "Pack extension" button to pack and sign your extension. Then try uploading it again — everything should work fine.
I successfully uploaded zip package in Opera store.
I faced with same issue ("persona.ini is missed") when tried to upload zip package with root folder - I mean zip content: "Sources/content (like manifest.json).
Chrome store accepted this package but for Opera you could try to create zip package with all content without parent folder (Sources folder in my case).
Opera doesn't support till now the .zip file you need to upload either .nex or .crx file.
To create a .nex file..
In your opera URL,just type opera://extensions
Click on Pack Extensions.
Browse to the root directory of your extension and click on okay.
The file will also create an .pem file along with .nex file. Keep your pem file safe and with you for uploading/upgrading your extension.
I'm creating an AIR app that will load an XML file (that can be edited by the user). It will load certain images specified by the XML file.
I'm currently using File.desktopDirectory.resolvePath() to access the XML file and the images from the desktop.
The AS3 reference for the File class specifies these static properties to access files.
File.applicationStorageDirectory—a storage directory unique to each installed AIR application
File.applicationDirectory—the read-only directory where the application is installed (along with any installed assets)
File.desktopDirectory—the user's desktop directory
File.documentsDirectory—the user's documents directory
File.userDirectory—the user directory
Using these would guarantee that the directories resolve correctly for different OS platforms.
So, is my current approach of just placing the XML file and the images(under subfolders) on the desktop the way to go? The user needs to be able to access the XML file to edit it and the folders to add/remove images. Is there an alternative to doing this? I don't think I can put it in the applicationDirectory, b/c the documentation warns against putting anything there that may change.