Posted 25 January 2017 - 03:05 PM
FLCF - Fast Lightweight Compressed File
Hello !
Today, I created a lightweight API called FLCF which will helps you to compress files.
Download it here:
http://pastebin.com/2rYQaQef
or with the CraftOS shell:
pastebin get 2rYQaQef FLCF
It's really simple to use it:
os.loadAPI("FLCF"); – Loads our API
FLCF.createArchive("/myArchive.flcf"); – Create the archive at the root directory.
uarch = FLCF.openArchive("/myArchive.flcf"); – Opens the archive newly created.
uarch.addFile("/rom/programs/edit", "/edit"); – Adds the file edit from /rom/programs to the root directory of the archive.
uarch.saveArchive(); – Save our edited archive.
uarch.extractFile("/edit", "/a_editor"); – Extracts the file edit from the root directory of the archive.
uarch.removeFile("/edit"); – Removes the file edit from the root directory of the archive.
uarch.saveArchive(); – Save our edited archive.
That is it. Note that if you want to add multiple files from a directory, use this code:
os.loadAPI("FLCF");
FLCF.createArchive("/myArchive.flcf");
uarch = FLCF.openArchive("/myArchive.flcf");
for _, file in ipairs(fs.list("/photos")) do
if fs.isDir("/photos/" .. file) then
uarch.addFile("/photos" .. file, file);
end
end
uarch.saveArchive();
License:
Because of a outdated project stolen by Anonymous (click there to see the topic) without any permission (and also my fault because I did not put a license), this API is under MIT license (click here for license details). You can freely edit, modify, share with your friends this program; but do not forget to take credit to me if you are going to use this in a program or a operating system.
Thanks for reading my little post. I hope that you will find it useful. Please take some time to write your impressions and what needs to be added.
Have a nice day, Redall.
Edited on 25 January 2017 - 02:10 PM