{ "name": "tftp-client", "version": "0.2.1", "description": "Very simple TFTP client", "keywords": [ "tftp" ], "author": { "name": "MiniGod" }, "repository": { "type": "git", "url": "http://github.com/MiniGod/TFTP-Client" }, "main": "./lib/tftp.js", "bin": { "tftp-client": "./bin/tftp.js" }, "readme": "# TFTP-Client\r\n\r\nA simple TFTP client for Node.Js. \r\n*Should not be used in production - first of all: this module is at an early stage (written in less than 12 hours), second: tftp is terrible*\r\n\r\n## Install\r\n\r\n### As a module\r\n`npm install tftp-client`\r\n\r\n### As CLI\r\n`npm install -g tftp-client`\r\n\r\n## Usage\r\n\r\n### Module\r\n\r\n`var client = new TFTP(port, client)` to create a new client.\r\n\r\n`client.read(filename, callback)` to **read** from the server. \r\n ~ The Callback is passed 2 arguments `(err, data)`, where `data` is the contents of the file. \r\n\r\n`client.write(filename, data, callback)` to **write** to the server, where `data` is the contents of the file. \r\n ~ The callback is passed 2 arguments `(err, bytes)`, where `bytes` is the number of bytes sent. \r\n\r\n**Simple read example:**\r\n\r\n```javascript\r\nvar TFTP = require('tftp-client');\r\n\r\n// Initialize the tftp client\r\nvar client = new TFTP(69, 'localhost');\r\n\r\n// Read 1.txt from the server\r\nclient.read('1.txt', function (err, data) {\r\n\tif (err) {\r\n\t\tconsole.error('ERROR:');\r\n\t\tconsole.error(err);\r\n\t\treturn;\r\n\t}\r\n\r\n\tconsole.log('Got data (%d bytes). First 100 bytes:', data.length);\r\n\tconsole.log(data.toString('utf8', 0, 100));\r\n});\r\n```\r\n\r\n### Command line\r\n\r\nTo install the tftp-client as CLI, run `npm install -g tftp-client`.\r\n\r\n`tftp-client (read|write) []`\r\n* hostname - Hostname of tftp server\r\n* read|write - Wether you want to read or write\r\n* filename - Path to the file you want to read or write\r\n* port - Optional. Defaults to 69\r\n\r\n**Example**:\r\n`tftp-client localhost read 1.txt`\r\n\r\n## TODO\r\n\r\n- Error packets - [RFC](http://tools.ietf.org/html/rfc1350#page-8). (implemented, but not tested)\r\n- Do the initial connection as defined in section 4 (TID's: port numbers from request ack) - [RFC](http://tools.ietf.org/html/rfc1350#section-4).\r\n- Currently, any DATA or ACK packet is responded to. Eg. An ACK packet will get a `DATA` response. There is not check for the block numbers to be in order.\r\n", "readmeFilename": "README.md", "_id": "tftp-client@0.2.1", "dist": { "shasum": "b66ceee832562b8a03ad616b40e3470f5dbd68c0" }, "_from": "tftp-client" }