Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {
ToastAndroid,
View,
Animated,
Easing,
StatusBar,
Text
} from 'react-native'
import fs from 'react-native-fs'
import { ViewPagerZoom } from 'react-native-image-zoom'
import PhotoView from 'react-native-photo-view'
declare var global
const psnineFolder = fs.ExternalStorageDirectoryPath + '/psnine'
console.log('==========================>')
fs.stat(psnineFolder).then(data => {
const isDirectory = data.isDirectory()
if (!isDirectory) {
fs.unlink(psnineFolder).catch(() => { }).then(() => fs.mkdir(psnineFolder))
}
}).catch(() => {
fs.mkdir(psnineFolder).catch(err => console.log(err, 'ImageViewer:line#27'))
})
const onSave = (image) => {
// console.log(image, psnineFolder + '/' + image.split('/').pop())
const result = fs.downloadFile({
fromUrl: image,
toFile: psnineFolder + '/' + image.split('/').pop()
})
async function create(song) {
let existDir = await RNFS.exists(RNFS.ExternalStorageDirectoryPath + '/MoeFM').then(boolean => boolean);
if (!existDir) await RNFS.mkdir(RNFS.ExternalStorageDirectoryPath + '/MoeFM');
let exist = await RNFS.exists(RNFS.ExternalStorageDirectoryPath + '/MoeFM/' + song.title + '.mp3').then(boolean => boolean);
if (!exist) {
RNFS.downloadFile({
fromUrl: song.url,
toFile: RNFS.ExternalStorageDirectoryPath + '/MoeFM/' + song.title + '.mp3',
background: true,
begin: ((res) => beginCallback(res, song)),
progress: (progressCallback)
}).promise.then((result) => {
resultCallback(result);
}).catch((err) => {
if(err.description === "cancelled") {
// cancelled by user
}
console.log(err);
handleInstall = (datHash) => {
try {
const dest = `${RNFS.ExternalStorageDirectoryPath}/AppHub/${datHash}`
RNFS.mkdir(dest)
.then(() => {
getApkPath(datHash)
.then(apkPath => {
if(apkPath) {
const publicPath = `${dest}${datHash}.apk`
RNFS.exists(publicPath)
.then(exists => {
if(!exists) {
RNFS.copyFile(apkPath, publicPath)
}
ApkInstaller.install(publicPath)
})
} else {
console.warn('APK not found')
}
*/
import React, {Component} from 'react'
import {
FlatList,
Text,
View,
StyleSheet
} from 'react-native'
import CustomButton from '../component/CustomButton'
let RNFS = require('react-native-fs');
let Sound = require('react-native-sound');
const MoeFMPath = RNFS.ExternalStorageDirectoryPath + '/MoeFM';
const NetEaseMusicPath = RNFS.ExternalStorageDirectoryPath + '/netease/cloudmusic/Music';
const QQMusicPath = RNFS.ExternalStorageDirectoryPath + '/qqmusic/song';
const KuGouMusicPath = RNFS.ExternalStorageDirectoryPath + '/kgmusic/download';
export default class LocalListPage extends Component {
constructor(props) {
super(props);
this.state = {
data: [],
};
}
playMusic(path) {
let sound = new Sound(path, '', (error) => {
if (error) {
console.log(error);
export const readDir = (
path = `${RNFS.ExternalStorageDirectoryPath}/Download`
) => RNFS.readDir(path);
* @date: 2017/5/18
* @description:
*/
import React, {Component} from 'react'
import {
FlatList,
Text,
View,
StyleSheet
} from 'react-native'
import CustomButton from '../component/CustomButton'
let RNFS = require('react-native-fs');
let Sound = require('react-native-sound');
const MoeFMPath = RNFS.ExternalStorageDirectoryPath + '/MoeFM';
const NetEaseMusicPath = RNFS.ExternalStorageDirectoryPath + '/netease/cloudmusic/Music';
const QQMusicPath = RNFS.ExternalStorageDirectoryPath + '/qqmusic/song';
const KuGouMusicPath = RNFS.ExternalStorageDirectoryPath + '/kgmusic/download';
export default class LocalListPage extends Component {
constructor(props) {
super(props);
this.state = {
data: [],
};
}
playMusic(path) {
let sound = new Sound(path, '', (error) => {
function httpRequests(start$: Stream): Stream {
const pingReq$ = xs
.periodic(300)
.startWith(0)
.endWhen(start$)
.mapTo({ category: "ping", url: "/ping" });
const setStoragePathReq$ = start$.mapTo({
category: "setStoragePath",
url: "/setStoragePath",
method: "POST",
send: { path: RNFS.ExternalStorageDirectoryPath + "/DatInstaller" },
});
const latestReq$ = start$
.map(() => xs.periodic(2000).startWith(null as any))
.flatten()
.mapTo({ category: "latest", url: "/latest" });
return xs.merge(pingReq$, setStoragePathReq$, latestReq$);
}