Coder Social home page Coder Social logo

xmodem.js's Introduction

Build Status Known Vulnerabilities Coverage Status

xmodem.js

XMODEM is a simple file transfer protocol. This project implements the protocol in JavaScript. Please see the API docs for more details.

Installation

npm install xmodem.js

Usage

Sending

var xmodem = require('xmodem.js');
xmodem.send(socket, buffer);

Receiving

var xmodem = require('xmodem.js');
xmodem.receive(socket, receiveFile);

xmodem.js's People

Contributors

afroewis avatar exsilium avatar hegemonic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

xmodem.js's Issues

If EOT block is not acknowledged, xmodem.js doesn't resend the EOT block again

I had the following situation while using this package:

  1. After the file was sent, xmodem.js sends EOT.
  2. Receiver responds with NAK.
  3. xmodem.js sends the last sent xmodem block again.

I think that this is not correct. Instead of sending the last block again, it should send the EOT command again.

When the uploader sends an EOT byte instead of an SOH byte, the downloader
sends a NAK byte. If the uploader sends another EOT immediately after that,
the downloader sends an ACK byte and the transfer is complete.

Or am I wrong?

I would be very happy to submit a PR for this, as I already fixed this problem on my local machine.

SerialPort doesn't function as a socket

I'm attempting to use xmodem to send data to a serial port. The API and code comments suggest this is possible. However if a SerialPort is given to the send function:

serialPort = new SerialPort(port, {baudRate: 9600}, false);
xmodem.send(port, buffer);

The following error occurs:

.\node_modules\xmodem.js\lib\index.js:221 Uncaught (in promise) TypeError: socket.on is not a function
    at Xmodem.send (.\node_modules\xmodem.js\lib\index.js:221)
    at ReadLineParser.<anonymous> (app.js:490)
    at ReadLineParser.emit (events.js:200)
    at addChunk (_stream_readable.js:294)
    at readableAddChunk (_stream_readable.js:271)
    at ReadLineParser.Readable.push (_stream_readable.js:210)
    at ReadLineParser.Transform.push (_stream_transform.js:150)
    at ReadLineParser._transform (.\node_modules\@serialport\parser-delimiter\delimiter.js:35)
    at ReadLineParser.Transform._read (_stream_transform.js:189)
    at ReadLineParser.Transform._write (_stream_transform.js:177)

Does this package not support SerialPort?

CRC failure on ZIP File

Hey @exsilium, first off... thank you for the library.

I am using this library to serve up a ZIP file for download from SyncTERM.
When I do that, I get a CRC failure. A standard TXT files seems to work fine however.
Am I missing something? The first chuck seems to be getting sent over perfectly, just a failing CRC.

Code:

xmodem.send(socket, fs.readFileSync('zines/LOD-4.ZIP'));

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.