Get file names in a folder from the client app? - browserify

Using fs library in the client app built with parcel doesn't work so const filenames = fs.readdirSync(partialsDir); won't do a thing. I have found that there is browserify-fs library that should do the same thing, but it seems that readdirSync doesn't exist in that library as well.
Is there any way to read file names with browserify-fs library?

Related

NWJS access external files on FlashDrive

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);

Extra files in Windows Store app package

just wondering if it's possible to include some files (one txt file in this case) in the app package that I need in the application folder. The thing is that I might use a piece of code that requires the license to be included in the app as a text file, and I think this would be one way to do it.
Thanks in advance.
Absolutely, it's really no different than including images for instance. And if you need to process the file within your app you can access it via its local path or explicitly use the ms-appx:/// protocol.
See How to reference content and How to load file resources for more details.
Just include the file in your project with Build Action set to Content. You can put it in any folder you like.
The file can then be accessed from the app either using the ms-appx: protocol or using the StorageFolder API:
var license = await Package.Current.InstalledLocation.GetFileAsync("license.txt");

OData and Objective C

I am trying to develop an ipad app that would interact with SQL server.Simple. So, i used WCF web service. I am getting the data there as xml. now, i want to develop an objective c client that would consume it. So, i used the odatagen tool to generate proxy. I did that and i got 2 files xyz.h and xyz.m. No more files. Now i have included them in my project. But in the xyz.h file i have error that says "import "OdataObject.h" file not found. I have done the header search path and library search path settings. What is missing.?
You have to include in your project the files that you should have in the OData4ObjC repository you cloned from github (or codeplex):
the .a library located in the /framework/bin/odatalib/lib/-yourplatform-/-yourversion-
all the files located in the /framework/bin/odatalib/include folder

Shared library and localizable.strings

I have created a shared library using Xcode 4.2 and objective c. My library includes a strings resource file that contains error messages. I then created a test application that loads and uses my library. I can't get to the string resource unless I manually copy the localizable.strings file into my test application project. Is there a way to access the resources contained in a library directly without copying to resource file?

Windows 8 metro application access arbitrary file path

In metro, the codes like following will throw exception:
String fileName = #"C:\Test\dd\ccc.jpg";
StorageFile file = await StorageFile.GetFileFromPathAsync(fileName);
However even if I check everything in capabilities, also File Picker was added and all file types allowed. I still can't access this file, the same exception will be thrown.
Does someone know how to read file in arbitrary file path? Is that possible in metro style application.
Not possible. You can get to the Libraries - pictures, documents, videos - and if the user puts that folder into one of those libraries (using Windows Explorer on the desktop side) you're all set. You can even write a desktop exe that will put the folder into the library, but you can't launch that exe yourself or be sure that the user hasn't changed the libraries by hand.
Look up SHCreateItemInKnownFolder for a starting point to the shell APIs for library work. I haven't tried calling those APIs from the Metro side; you can see if they help but my bet is they will not be available. If you don't like the COM interop to the shell APIs you could look at the source code to the Windows API Code Pack - I wouldn't want to bundle all of it with a Metro app, but you could copy parts of it to your application.