If you are looking at this book, maybe you want to know why you should use NativeScript and what sets it apart from the crowded competition. Why shouldn't you use any of the other cross-platform tools? Let us dig in, and I'll explain why NativeScript is the answer to the best way of executing cross-platform mobile development.
var javaFile = new java.io.File('/some/file/name.ext'); var exists = javaFile.exists();
var fileManager = NSFileManager.defaultManager(); var exists = fileManager.fileExistsAtPath('/some/file/name.ext');
Now, before you get worried about having to know both iOS and Android to make your application, NativeScript has that covered. To simplify things, NativeScript already has a wide number of components, or modules, that wrap the most common things a developer will need, which are called the NativeScript common core modules. So, instead of having to write any Android or iOS specific code like I did above to see if a file exists, you can just write the following code:
var fs = require('file-system'); var exists = fs.File.exists(path);