Coder Social home page Coder Social logo

about copy() method about node-mumble HOT 2 CLOSED

rantanen avatar rantanen commented on July 17, 2024
about copy() method

from node-mumble.

Comments (2)

Rantanen avatar Rantanen commented on July 17, 2024
var received = this.buffers[0];

buffers is written on lines 18 and 62:

18: this.buffers.push(data);  // data is event data from socket.on('data').
62: this.buffers[0] = received.slice(remaining);  // Slice on 'buffer' returns a 'buffer'.

So as long as the 'data' event of the socket returns buffers, the buffers member should be full of buffers.

The data event may return a Buffer or String depending on whether it has been set an encoding: http://nodejs.org/api/stream.html#stream_event_data

MumbleSocket never sets the encoding, so according to the API docs it should never return a string.

Which Node.js version are you running? I've been mostly testing this with v0.10.x

from node-mumble.

page1234 avatar page1234 commented on July 17, 2024

I get it,I make a mistake that I set encoding in my code.
And thank you for your annotation

from node-mumble.

Related Issues (20)

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.