[plugin] Node-webkit Node.js FS module

0 favourites
  • 9 posts
From the Asset Store
Node Downloader is a plugin for download file for Construct 3 and construct 2 game engine
  • In heavy development - release often, release early

    File I/O is provided by simple wrappers around standard POSIX functions.

    This plugin exposes sync functions

    Use with absolute care, you can erase all data on your computer if you <img src="smileys/smiley35.gif" border="0" align="middle"> up!

    Demo - reads contents of c: and returns a string representation of returned array - ok to use

    Plugin

    This module exposes Bunch of stuff, sync and async, this is just a small small part of everything available!

    Exposed stuff:

    Actions

       - renameSync

       - unlinkSync

       - mkdirSync

    Expression

       - readdirSync

    I tested only readdirSync, so for actions i cannot guarantee anything!

  • Does this mean I can finally create a savegame.sav in for example C:\Games\Mygame\Save DiR and write data into it? Can I load the savegame back?

    So the absolutely gruesome javascript HDD-access restriction does no longer apply?

  • Nope...

    This applies only to the node-webkit export!

    If you export to .exe or mac app you can use this plugin to access file system.

    Note that i threw this plugin in few hours just to show it's possible, so consider this just as a starting point to write this up even more further!

    Check out nodejs.org/api/fs.html what's possible with this node.js module!

    Cheers!

  • So these functions are only for local storage then?

    fs.writeSync(fd, buffer, offset, length, position)#

    Synchronous version of fs.write(). Returns the number of bytes written.

    :(((

  • Sorry, i haven't been clear!

    If you export with node-webkit, this gives you full access to the file system (e.g. the game can delete the contents of your drive if you die)

    If you use this plugin in the classic html5 export, it will probably break your game, or it won't do anything.

    For local or webstorage use the official plugins.

    Cheers!

  • So to be perfectly clear: If I export my Construct 2 game with node-webkit i can code-in node.js file-access routines to create a C:\GAME\SAVES directory with

    fs.mkdir(path, [mode], [callback])

    then save into this directory a file called savegame.dat with

    fs.writeFile(filename, data, [encoding], [callback])

    and all relevant functions like append, read, etc..

    So the EXE compiled with node-webkit has full access to the drive?

    If this is so I only need to find an installer that installs my Construct 2 game to the user given path: for example C:\Program Files\C2Arcadegame

    then file-access wise we are in the best situation.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yup, that's pretty much that!

    Just to repeat myself, i really made this plugin in a hurry, if you do some changes to it (and i hope you will! :) please share, so we can improve this plugin!

    Cheers!

  • Wow! This is what we have been waiting for! Getting free of local-storage.

    Nope, my hands are full with creating graphics and basic game code. I plan however to hire C2/js programmer to do elaborate work, where needed. Then once the game is on the market making profits, release the in-house plugins as open-source.

  • Cool, sounds like a plan!

    Currently i don't need this plugin in my projects, so i won't be developing it further, but if i make a new version i plan to release it to the community!

    Cheers, and good luck with your game!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)