function poolWriteVariableWidthInto()

in string_rw.js [74:88]


function poolWriteVariableWidthInto(destResult, str, buffer, offset) {
    var size = 0;
    if (typeof str === 'string') {
        size = Buffer.byteLength(str, this.encoding);
    } else if (str !== null && str !== undefined) {
        return destResult.reset(errors.expected(str, 'string, null, or undefined'), offset);
    }
    var res = this.sizerw.poolWriteInto(destResult, size, buffer, offset);
    if (res.err) return res;
    offset = res.offset;
    if (typeof str === 'string') {
        res.offset += buffer.write(str, offset, this.encoding);
    }
    return res;
};