0
I need to print the variable result with line break in a txt file, I have the following code :
var Resultado = formatters.addTrailingZeros(req.query.Nrbanco, 3) +
'0000' +
'0' +
formatters.addEspacos(' ', 9) +
formatters.addTrailingZeros(req.query.TipoInscricao, 1) +
formatters.addTrailingZeros(req.query.IncricaoCedente, 15) +
formatters.addTrailingZeros(req.query.Convenio, 20) +
formatters.addTrailingZeros(req.query.Agencia , 5) +
formatters.addTrailingZeros(req.query.AgenciaDigito , 1) +
formatters.addTrailingZeros(req.query.Conta , 12) +
formatters.addTrailingZeros(req.query.ContaDigito , 1) +
' ' +
formatters.addTrailingZeros(req.query.Cedente , 30) +
formatters.addEspacos('CEDRED' , 30) +
formatters.addEspacos(' ', 10) +
'1' +
formatters.addTrailingZeros(req.query.DataGeracaoArquivo , 8) +
formatters.addTrailingZeros(req.query.HoraGeracaoArquivo , 6) +
formatters.addTrailingZeros(req.query.NumeroRemessa, 6) +
'087' +
formatters.addTrailingZeros(0, 5) +
formatters.addEspacos(' ', 20) +
formatters.addEspacos(' ', 20) +
formatters.addEspacos(' ', 29);
// Aqui preciso inserir uma quebra de linha já tentei o \n e não funcionou
Resultado = Resultado +
formatters.addTrailingZeros(req.query.Nrbanco, 3) +
'0001' +
'1' +
'R' +
'01' +
' ' +
'045' +
' ' +
formatters.addTrailingZeros(req.query.TipoInscricao, 1) +
formatters.addTrailingZeros(req.query.IncricaoCedente, 15) +
formatters.addTrailingZeros(req.query.Convenio, 20) +
formatters.addTrailingZeros(req.query.Agencia, 15) +
formatters.addTrailingZeros(req.query.AgenciaDigito , 1) +
formatters.addTrailingZeros(req.query.Conta , 12) +
formatters.addTrailingZeros(req.query.ContaDigito , 1) +
' ' +
formatters.addEspacos(req.query.Cedente , 30) +
formatters.addEspacos(' ', 40) +
formatters.addEspacos(' ', 40) +
formatters.addTrailingZeros(req.query.NumeroRemessa, 8) +
formatters.addTrailingZeros(req.query.DataGeracaoArquivo , 8) +
formatters.addTrailingZeros('0' , 8) +
formatters.addTrailingZeros('0' , 33);
var stream = Fs.createWriteStream("C:/16/consignment.txt"); stream.Once('open', Function(fd) { stream.write(Result); stream end.(); });
I tried other ways to print this variable in txt format breaking line and I was unsuccessful, thank you if anyone has any suggestions.