Permalink
Browse files

Improved docs

  • Loading branch information...
1 parent da177a0 commit 2fc2294378c3b35802bbaf7e9d0ea1ab3726ccd6 @VanCoding committed Mar 22, 2013
Showing with 15 additions and 3 deletions.
  1. +15 −3 readme.md
View
@@ -13,9 +13,21 @@ A node.js module to read/write from/to region files of Minecraft.
###Methods
-- **open( cb )**
-- **init( cb )**
-- **close( cb )**
+- **open( cb )** Opens a mca-file for reading/writing. Call this function before everything else.
+ - cb: function(err){}
+- **init( cb )** Loads the offset & sector table into memory to keep track of unused space in the file. Before calling write functions, it is neccessary to call this function first. For read operations, it is not neccessary, but it speeds it up, though.
+ - cb: function(err){}
+- **read( x, y, cb )** Read a chunk from the region
+ - x: int The x-coordinate of the chunk. Must be between 0 and 31.
+ - y: int The y-coordinate of the chunk. Must be between 0 and 31.
+ - cb: function(err,chunk){}
+- **write( x, y, chunk, cb )** Write a chunk to the region
+ - x: int The x-coordinate of the chunk. Must be between 0 and 31.
+ - y: int The y-coordinate of the chunk. Must be between 0 and 31.
+ - chunk: Buffer A buffer that holds the chunkdata to write
+ - cb: function(err){}
+- **close( cb )** Closes the file. Call this function after all reading/writing to the file is done to free up memory.
+ - cb: functtion(err){}
##License

0 comments on commit 2fc2294

Please sign in to comment.