mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-16 08:30:07 +00:00
chore: fixing the error when using in angular, added isNode check for imports
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
import * as path from 'path'
|
import { isNode } from '../utils'
|
||||||
import { getRealPath, folderExists, createFolder } from '@sasjs/utils'
|
|
||||||
|
|
||||||
export const getTmpFolderPath = async () => {
|
export const getTmpFolderPath = async () => {
|
||||||
|
if (!isNode()) return 'Error: not node environment'
|
||||||
|
|
||||||
|
const { getRealPath, folderExists, createFolder } = require('@sasjs/utils/file')
|
||||||
|
const path = require('path')
|
||||||
const tmpFolderPath = path.join(__dirname, '..', 'tmp')
|
const tmpFolderPath = path.join(__dirname, '..', 'tmp')
|
||||||
|
|
||||||
if (!(await folderExists(tmpFolderPath))) await createFolder(tmpFolderPath)
|
if (!(await folderExists(tmpFolderPath))) await createFolder(tmpFolderPath)
|
||||||
@@ -9,8 +12,20 @@ export const getTmpFolderPath = async () => {
|
|||||||
return tmpFolderPath
|
return tmpFolderPath
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getTmpFilesFolderPath = async () =>
|
export const getTmpFilesFolderPath = async () => {
|
||||||
path.join(await getTmpFolderPath(), 'files')
|
if (!isNode()) return 'Error: not node environment'
|
||||||
|
|
||||||
export const getTmpLogFolderPath = async () =>
|
const { getRealPath, folderExists, createFolder } = require('@sasjs/utils/file')
|
||||||
path.join(await getTmpFolderPath(), 'log')
|
const path = require('path')
|
||||||
|
|
||||||
|
return path.join(await getTmpFolderPath(), 'files')
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getTmpLogFolderPath = async () => {
|
||||||
|
if (!isNode()) return 'Error: not node environment'
|
||||||
|
|
||||||
|
const { getRealPath, folderExists, createFolder } = require('@sasjs/utils/file')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
return path.join(await getTmpFolderPath(), 'log')
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user