Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Resolved]Error occurred when launching my first geddy app #736

Open
JasonDepp opened this issue Jun 14, 2017 · 4 comments
Open

[Resolved]Error occurred when launching my first geddy app #736

JasonDepp opened this issue Jun 14, 2017 · 4 comments

Comments

@JasonDepp
Copy link

image
image
I tried to replace this with "new Buffer(16*1024)", but the app stuck there, seems that can't finish reading file ever.
Please help me out.
Thanks

@JasonDepp
Copy link
Author

Issue resolved
image

    fs.open(filepath, 'r', parseInt(666, 8), function (err, fd) {
      var pos = 0;
      var len = 0;
      var buffer = new Buffer(16 * 1024);
      var streamChunk = function () {
        fs.read(fd, buffer, 0, 16 * 1024, pos,
            function (err, bytesRead, chunk) {
          if (!chunk) {
            fs.close(fd);
            self.resp._length = len;
            self.resp.end();
            return;
          }
          len += Buffer.byteLength(chunk);
          self.resp.write(chunk, encoding);
          pos += bytesRead;

          streamChunk()
        });
      }
      streamChunk();
    });

@JasonDepp JasonDepp changed the title Error occurred when launching my first geddy app [Resolved]Error occurred when launching my first geddy app Jun 14, 2017
@JasonDepp
Copy link
Author

please close this ticket.
thanks.

@phanect phanect closed this as completed Jun 14, 2017
@JasonDepp
Copy link
Author

JasonDepp commented Jun 15, 2017

Did I change the code correctly? Will you make the same change to geddy code as well?

@mde
Copy link
Contributor

mde commented Jun 15, 2017

Was this a bug in Geddy? If so, perhaps we should have left the ticket open. What was the underlying problem? Could you submit a PR for fixing it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants