opened
mitkodkn
username_0
I'm currently trying to save a base64 string as a file but the only way I know this can happen is through the Node core module 'fs'. When I try to require it, it says that the module cannot be found. I don't know what to do since the writeText method in the NativeScript 'file-system' module only supports writing a string to a file. Is there any way to convert a base64 file into a real binary file. (Note: It's not about a base64 image.)
Using 'fs' Node core module in NativeScript
issue
created
NekR
username_1
First of all, NativeScript does not have Node's module or its environment. 
About base64 and your case. As you may know, strings can be represented as a set of bytes and similarly any file can be represented as a string. So in your case, you just indeed need to write base64 as a file content. But first, of course, you need to convert your content to base64, here is two ways:

* Write a JavaScript function for it, or use some existing one from npm, like this https://www.npmjs.com/package/base-64 one, or this https://www.npmjs.com/package/abab
* Use crypto capabilities of your device/platform where NativeScript is run on
comment
created
enchev
username_2
Hey @username_0,

We do have two polyfills for browser like [```fetch``` and ```XMLHttpRequest```](http://docs.nativescript.org/modules#whatwg-polyfills) however we do not have any polyfills for Node and that is why modules that will access ```process```, ```nextTick()```, streams, etc. will not work out-of-the-box.

HTH
comment
closed
enchev
username_2
issue
created
Nixon1979
username_3
Hey @username_2 ,

I am using the file-system module of nativescript and while i write an image using destinationFile.writeSync i get the following error

Error: java.lang.Exception: Failed resolving method write on class java.io.FileOutputStream
JS:     com.tns.Platform.resolveMethodOverload(Platform.java:767)
JS:     com.tns.Platform.callJSMethodNative(Native Method)
JS:     com.tns.Platform.dispatchCallJSMethodNative(Platform.java:816)
JS:     com.tns.Platform.callJSMethod(Platform.java:715)
JS:     com.tns.Platform.callJSMethod(Platform.java:694)
JS:     com.tns.Platform.callJSMethod(Platform.java:684)
JS:     com.tns.NativeScriptActivity.onActivityResult(NativeScriptActivity.java:49)
JS:     android.app.Activity.dispatchActivityResult(Activity.java:6632)
JS:     android.app.ActivityThread.deliverResults(ActivityThread.java:4192)
JS:     android.app.ActivityThread.handleSendResult(ActivityThread.java:4239)
JS:     android.app.ActivityThread.access$1400(ActivityThread.java:181)
JS:     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1531)
JS:     android.os.Handler.dispatchMessage(Handler.java:102)
JS:     android.os.Looper.loop(Looper.java:145)
JS:     android.app.ActivityThread.main(ActivityThread.java:6145)
JS:     java.lang.reflect.Method.invoke(Native Method)
JS:     java.lang.reflect.Method.invoke(Method.java:372)
JS:     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
JS:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
comment