is there a library to unRAR files? The rar files I have to work with contain multiple files.
I'm looking for a way to navigate rar content, and get a blob with the uncompressed content of a selected file within the .rar one.
I'm already using zip.js to unzip files, and need the same for RAR. Thanks a lot for your time reading it.
I know this is an old question. But bitjs is no longer maintained, and very hard to use.
Try https://github.com/workhorsy/uncompress.js . It even works with RAR 5.
Here is the most trivial example I could make: http://workhorsy.github.io/uncompress.js/examples/trivial/index.html .
Related
Let's say I have a folder of about 100 images on my website called "IMG"
Now let's say I have a div element: <div id="templateDiv"></div>
Using javascript, how would I add all images from "IMG/" into that div without adding <img src="IMG/IMGNAME.jpg"> for every image?
Sorry, I'm not very good at explaining.
Just ignore the fact that would take ages to load.
EDIT
Ok my bad explanation skills have made me change my question.
How do I automatically make array of all files in website directory?
Okay, your question is incredibly unclear, but from reading all your other comments and things, it seems you simply want to get an array that contains the filename of every file in a directory? If that's what you want, then it won't be possible (I don't believe) since only the server knows which files are where, and you can't request the contents of a directory from a server using JavaScript.
However if you were using Node.js on a local directory, then it could be done. But I don't believe that's your case.
That being said, you have three alternative options:
Name every image file 1.png, 2.png, 3.png, etc. Then use a for loop and get each one using (i + 1) + ".png"
If you can't rename the files, but the files are named via user input, you could collect the user's input at the time of file creation and add the name of the newly created file into another file/an array/localStorage so that it could be retrieved later.
If you can't rename the files, but the filenames are also never known to the program that needs them, then you could create an array of all the filenames (manually) and iterate over that to find all the files that you want.
Please, somebody let me know if I'm wrong and if there actually is a way to make a request to a server that tells the client all the files in a directory. That seems incredibly unlikely though.
Another potential solution just came to mind. You could write a PHP script (or Node.js or any server-side language, really) that scans a directory, creates a list of all the filenames there, and then sends that back over HTTP. Then you could simply make an XMLHttpRequest to that PHP file and have it do the work. How does that sound?
Intro
Hi, I was looking for answer in the whole Internet (in some way I kind of feel that I know every question in Stack Overflow), but the answers were never appropriate to what I'm looking for. I was trying to avoid posting question here, but situation forced me to do this.
Sorry if the answer is simpler than I think.
I'm in the middle of building my first app in Electron using JavaScript. I think that I should describe it in few words, so flam:ngo™ (which is projects name) should work like this:
User will upload two files:
file with tables (like XLSX or DOC)
file with data and blank spaces (which will be used as a template)
App will import from tables.
Now app should let user choose which rows he's interested in and where in uploaded file he wants them to be placed.
flam:ngo save document in PDF (or DOC).
Clue
Right now I need solutions just for myself and in little simpler form. For now I need flam:ngo just to work with one specify XLSX and with one DOC template, but I stuck. I know which rows in document I will always need, but I don't know what should I write to specify in JS's code that I need exactly this ones (like hey, app, pick only this one, this one and maybe this one) while JS is reading file and I don't know how to create new DOC (or PDF) file, how to write data in specified blank spaces and then at the end: how to save it in direction which I should choose for every time I'm using an app - everything in one, maybe two, processes.
Ending
Could you, please, help me: for now I have implemented file uploader which is importing file in XLSX and which is saving it as CSV, XML oraz HTML. What should I do to keep moving forward?
I really appreciate your help!
PS. For better explanation:
For now this should look like this:
1. "template.docx" is uploaded in the core
2. user uploads .xlsx
3. app reads tables and select rows chosen in code
4. app puts data from chosen rows in specify places
5. app saves file > new life of the app :)
Ok, so it's been a while and app has been already written by me. Maybe this will help someone in the future:
Solution
Packages that helps me with this issue was:
js-xlsx which converts my file to simple HTML file, where cells from my XLSX template file have always the same ID (which was important for me to work with document templates).
officegen which helps me write brand new document based on earlier prepared template.
Rest of it was just Vanilla JS.
Where do I put .js files in Max?
I am currently using help from this thread on the Cycling forum to link Philips Hue lighting with Max 7.
https://cycling74.com/forums/topic/controlling-philips-hue-using-jython-and-phue/ and currently trying to use this method. https://gist.github.com/tgck/11185861#file-huerequestbuilder-js
I have got the patch in my patcher window but I don't know where to put the .js (HueRequestBuidler.js) file that it needs to run. Where do I put this file for Max to be able to read it and link with the patch?
I'm sure this has been asked before but I searched and couldn't find any answers that helped me out.
You typically place js files in the same folder as your patch. There should be a [js HueRequestBuidler] object in the patch that uses it.
Add the folder containing your .js files to the Max search path in Options/File Preferences. You can find more documentation here.
i'm confused as to how i could implement epub.js.
(https://github.com/futurepress/epub.js/blob/master/documentation/README.md) i'm having a hard time understanding the documentation since i'm new. I tried following the demo files and folders and the "basic" example file but i noticed the paths direct to a folder named "OPS" which has a file for every chapter and others.
so i'm stuck on what to do with the .epub files and how to get a folder like that given my epub files.
simply change file extension of .epub to .zip and unpack yours books. When you done that, edit this part:
var Book = ePub("url/to/book/"); // With default options
where and give it path to your book.
I ask here in the hope that some members will be familiar enough with 'plupload' to help.
This little Jquery script is on the way to making my file-upload problems go away, so any help would be greatly appreciated.
Question:
I can upload large files using plupload, but when the appear on the server the name has changed to gibberish,
EG p163g1k1er15n310bi18bq1af61rc21.zip
From my experience with basic upload forms my assumption is that it is writing out a temp filename with the intention of renaming it to the original filename when the chunked sections have been put back together, but for some reason it may not be doing this.
I have changed the permission on the folder to 777, so I'm reasonably sure this isn't the issue.
The runtime being used is Flash (I require the chunking feature). It's version 1.4.3.2
As always, any help would be much appreciated.
There is a configuration option to generate unique file names instead of using the actual file name.
From the docs:
unique_names
Generate unique filenames when uploading. This will generate unqiue
filenames for the files so that they
don't for example collide with
existing ones on the server.
Make sure this option is not enabled in your configuration (it is not by default). There are still some file name cleaning routines run by the default included php upload script...
// Clean the fileName for security reasons
$fileName = preg_replace('/[^\w\._]+/', '', $fileName);
...and an underscore is always appended with a number if the file exists (regardless of configuration), like filename_2.jpg, but aside from that it should not be altering your file names.
EDIT: I've been searching the forums for a solution but coming up short, my last piece of advice is to try the HTML5 runtime, to see if this is related to the Flash runtime somehow, as there have been some issues with previous versions. If all else fails, post on the forum - the admins there are very responsive. Best of luck, please post a solution here if you find it.
Ploploader uses a variable called "unique_names"; in my case this was set to TRUE, however to preserve the actual filenames it should be set to false. Solution came from the Pluploader forum.
To keep original filename, if you use the upload.php provided by plupload then I had to change upload.php line 34 from
$fileName = isset($_REQUEST['name']) ? $_REQUEST['name'] : '';
to
$fileName = isset($_FILES['file']["name"]) ? $_FILES['file']["name"] : '';
I had the same problem. An another solution is to inject real file name as a new input into FormData object.
(I am using chrome and HTML5 runtime!)
in plupload.html5.js file find the creation of object O = new FormData();
and
add some injections with
var oFileName = $("input[name='oFileName']").val();
O.append("oFileName", V.name);
After this adding get the real file name in your server side (for upload.php)
$oFileName = $_REQUEST["oFileName"];