title: Jenkins pipeline: write file in different directory than workspace
body: <p>I use this in my Jenkins pipeline:</p>
  
  <pre><code>def script = libraryResource 'tests/checks-test.sh'
  file: 'script.sh', text: script
  </code></pre>
  
  <p>This will write a file <code>script.sh</code> in my workspace. Now I want that this file isn't in my workspace. (A bit like managed files which are in the <code>/tmp/</code> folder of jenkins.</p>
  
  <p>How can I force my pipeline to write the file in the <code>/tmp</code> folder and not in my workspace? </p>