Merge pull request #176 from Matze2010/master
Possibility to set filename of literal data packet (tag 11)
This commit is contained in:
commit
6bb53f04b4
|
@ -38,6 +38,7 @@ function Literal() {
|
|||
this.format = 'utf8'; // default format for literal data packets
|
||||
this.data = ''; // literal data representation as native JavaScript string or bytes
|
||||
this.date = new Date();
|
||||
this.filename = 'msg.txt';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,6 +85,24 @@ Literal.prototype.getBytes = function () {
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* Sets the filename of the literal packet data
|
||||
* @param {String} filename Any native javascript string
|
||||
*/
|
||||
Literal.prototype.setFilename = function (filename) {
|
||||
this.filename = filename;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get the filename of the literal packet data
|
||||
* @returns {String} filename
|
||||
*/
|
||||
Literal.prototype.getFilename = function() {
|
||||
return this.filename;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Parsing function for a literal data packet (tag 11).
|
||||
*
|
||||
|
@ -117,7 +136,7 @@ Literal.prototype.read = function (bytes) {
|
|||
* @return {String} string-representation of the packet
|
||||
*/
|
||||
Literal.prototype.write = function () {
|
||||
var filename = util.encode_utf8("msg.txt");
|
||||
var filename = util.encode_utf8(this.filename);
|
||||
|
||||
var data = this.getBytes();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user