pax_global_header00006660000000000000000000000064127733700100014512gustar00rootroot0000000000000052 comment=1abf9cf5611b4be7377060ea67054b45cbf6813c os-tmpdir-1.0.2/000077500000000000000000000000001277337001000134305ustar00rootroot00000000000000os-tmpdir-1.0.2/.editorconfig000066400000000000000000000002761277337001000161120ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [{package.json,*.yml}] indent_style = space indent_size = 2 os-tmpdir-1.0.2/.gitattributes000066400000000000000000000000351277337001000163210ustar00rootroot00000000000000* text=auto *.js text eol=lf os-tmpdir-1.0.2/.gitignore000066400000000000000000000000151277337001000154140ustar00rootroot00000000000000node_modules os-tmpdir-1.0.2/.travis.yml000066400000000000000000000001151277337001000155360ustar00rootroot00000000000000sudo: false language: node_js node_js: - '6' - '4' - '0.12' - '0.10' os-tmpdir-1.0.2/index.js000066400000000000000000000010741277337001000150770ustar00rootroot00000000000000'use strict'; var isWindows = process.platform === 'win32'; var trailingSlashRe = isWindows ? /[^:]\\$/ : /.\/$/; // https://github.com/nodejs/node/blob/3e7a14381497a3b73dda68d05b5130563cdab420/lib/os.js#L25-L43 module.exports = function () { var path; if (isWindows) { path = process.env.TEMP || process.env.TMP || (process.env.SystemRoot || process.env.windir) + '\\temp'; } else { path = process.env.TMPDIR || process.env.TMP || process.env.TEMP || '/tmp'; } if (trailingSlashRe.test(path)) { path = path.slice(0, -1); } return path; }; os-tmpdir-1.0.2/license000066400000000000000000000021371277337001000150000ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) Sindre Sorhus (sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. os-tmpdir-1.0.2/package.json000066400000000000000000000012401277337001000157130ustar00rootroot00000000000000{ "name": "os-tmpdir", "version": "1.0.2", "description": "Node.js os.tmpdir() ponyfill", "license": "MIT", "repository": "sindresorhus/os-tmpdir", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "engines": { "node": ">=0.10.0" }, "scripts": { "test": "xo && ava" }, "files": [ "index.js" ], "keywords": [ "built-in", "core", "ponyfill", "polyfill", "shim", "os", "tmpdir", "tempdir", "tmp", "temp", "dir", "directory", "env", "environment" ], "devDependencies": { "ava": "*", "xo": "^0.16.0" } } os-tmpdir-1.0.2/readme.md000066400000000000000000000012651277337001000152130ustar00rootroot00000000000000# os-tmpdir [![Build Status](https://travis-ci.org/sindresorhus/os-tmpdir.svg?branch=master)](https://travis-ci.org/sindresorhus/os-tmpdir) > Node.js [`os.tmpdir()`](https://nodejs.org/api/os.html#os_os_tmpdir) [ponyfill](https://ponyfill.com) Use this instead of `require('os').tmpdir()` to get a consistent behavior on different Node.js versions (even 0.8). ## Install ``` $ npm install --save os-tmpdir ``` ## Usage ```js const osTmpdir = require('os-tmpdir'); osTmpdir(); //=> '/var/folders/m3/5574nnhn0yj488ccryqr7tc80000gn/T' ``` ## API See the [`os.tmpdir()` docs](https://nodejs.org/api/os.html#os_os_tmpdir). ## License MIT © [Sindre Sorhus](https://sindresorhus.com) os-tmpdir-1.0.2/test.js000066400000000000000000000022431277337001000147460ustar00rootroot00000000000000import test from 'ava'; import m from './'; const os = {tmpdir: m}; test(t => { // https://github.com/nodejs/node/blob/3e7a14381497a3b73dda68d05b5130563cdab420/test/parallel/test-os.js#L6-L38 process.env.TMPDIR = '/tmpdir'; process.env.TMP = '/tmp'; process.env.TEMP = '/temp'; if (process.platform === 'win32') { t.is(os.tmpdir(), '/temp'); process.env.TEMP = ''; t.is(os.tmpdir(), '/tmp'); process.env.TMP = ''; const expected = (process.env.SystemRoot || process.env.windir) + '\\temp'; t.is(os.tmpdir(), expected); process.env.TEMP = '\\temp\\'; t.is(os.tmpdir(), '\\temp'); process.env.TEMP = '\\tmpdir/'; t.is(os.tmpdir(), '\\tmpdir/'); process.env.TEMP = '\\'; t.is(os.tmpdir(), '\\'); process.env.TEMP = 'C:\\'; t.is(os.tmpdir(), 'C:\\'); } else { t.is(os.tmpdir(), '/tmpdir'); process.env.TMPDIR = ''; t.is(os.tmpdir(), '/tmp'); process.env.TMP = ''; t.is(os.tmpdir(), '/temp'); process.env.TEMP = ''; t.is(os.tmpdir(), '/tmp'); process.env.TMPDIR = '/tmpdir/'; t.is(os.tmpdir(), '/tmpdir'); process.env.TMPDIR = '/tmpdir\\'; t.is(os.tmpdir(), '/tmpdir\\'); process.env.TMPDIR = '/'; t.is(os.tmpdir(), '/'); } });