From bf74d08d445939b5c2d4db0d330c4e8190065268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Mon, 28 Sep 2020 09:53:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 7 +++++-- package.json | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 54012b5..fa585f5 100644 --- a/index.js +++ b/index.js @@ -10,10 +10,11 @@ import { parseCookie } from './lib/cookie.js' import fs from 'iofs' import URL from 'url' import QS from 'querystring' +import PATH from 'path' -var __dirname = path.dirname(URL.fileURLToPath(import.meta.url)) +var __dirname = PATH.dirname(URL.fileURLToPath(import.meta.url)) -var tmpdir = path.resolve(__dirname, './.tmp/') +var tmpdir = PATH.resolve(__dirname, './.tmp/') var encode = encodeURIComponent var decode = decodeURIComponent @@ -40,6 +41,8 @@ export default class Request { if (fs.isdir(tmpdir)) { fs.rm(tmpdir) + } else { + fs.mkdir(tmpdir) } } diff --git a/package.json b/package.json index b0bf9ee..46474f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gm5/request", - "version": "1.2.2", + "version": "1.2.3", "description": "对Http的request进一步封装, 提供常用的API", "main": "index.js", "author": "yutent",