<commit_before>var express    = require('express')
var fs = require('fs');
var path = require('path');
var app = express();
var stream = fs.createWriteStream('public/file.txt');

app.get('/', function(req, res) {
  res.sendFile(path.join(__dirname, 'public/index.html'), function (err) {
    if (err) {
      console.log(err);
      res.status(err.status).end();
    }
    else {
      console.log('Sent');
      res.status(200);
    }
  });
  
});

app.get('/file', function (req, res) {
  res.sendFile(path.join(__dirname, 'public/file.txt'));
})

app.put('/file/:contents', function (req, res) {
  stream.write(req.params.contents);
});

app.listen(3000);<commit_msg>using pipe-io, does not work<commit_after>var express    = require('express'),
    fs = require('fs')
    path = require('path'),
    app = express(),
    file = 'public/file.txt',
    readStream  = fs.createReadStream(file),
    writeStream = fs.createWriteStream(file),
    pipe        = require('pipe-io');

app.get('/', function(req, res) {
  res.sendFile(path.join(__dirname, 'public/index.html'), function (err) {
    if (err) {
      console.log(err);
      res.status(err.status).end();
    }
    else {
      console.log('Sent');
      res.status(200);
    }
  });
  
});

app.get('/file', function (req, res) {
  res.sendFile(path.join(__dirname, 'public/file.txt'));
})

app.put('/file/:contents', function (req, res) {
  //stream.write(req.params.contents);
  pipe([readStream, writeStream], function(error) {
    console.log(error || 'done');
  });
});

app.listen(3000);
{'fraction_non_alphanumeric': 0.20398970398970398, 'fraction_numerical': 0.009009009009009009, 'mean_word_length': 3.3926553672316384, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '383459', 'n_tokens_mistral': 539, 'n_tokens_neox': 530, 'n_words': 92}